Skip to content

Merge pull request #75 from WordPress/fix/prevent-fatals-if-meta-data… #45

Merge pull request #75 from WordPress/fix/prevent-fatals-if-meta-data…

Merge pull request #75 from WordPress/fix/prevent-fatals-if-meta-data… #45

Workflow file for this run

name: Build Plugin ZIP
on:
push:
branches:
- main
jobs:
bump-version:
runs-on: ubuntu-latest
outputs:
old_version: ${{ steps.get_version.outputs.old_version }}
new_version: ${{ steps.get_version.outputs.new_version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Compute old and new version
id: get_version
run: |
OLD_VERSION=$(jq --raw-output '.version' package.json)
echo "old_version=${OLD_VERSION}" >> $GITHUB_OUTPUT
NEW_VERSION=$(npx semver $OLD_VERSION -i patch)
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
- name: Configure git user name and email
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Update plugin version
env:
VERSION: ${{ steps.get_version.outputs.new_version }}
run: |
cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package.json) > package.json
cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package-lock.json) > package-lock.json
sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" wpmovies.php
- name: Commit the version bump
id: commit_version_bump
run: |
git add wpmovies.php package.json package-lock.json
git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}"
git push
echo "version_bump_commit=$(git rev-parse --verify --short HEAD)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: bump-version
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Composer dependencies
run: composer install --no-dev
- name: Install npm dependencies
run: npm ci
- name: Build plugin
run: npm run build
- name: Create plugin ZIP file
run: npm run plugin-zip
- name: Create theme ZIP file
run: npm run theme-zip
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.bump-version.outputs.new_version }}
files: |
wp-movies-plugin.zip
wp-movies-theme.zip