Merge pull request #50 from WordPress/fix-mobile-layout #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |