Skip to content

Clean up package.json and update @wordpress/env #180

Clean up package.json and update @wordpress/env

Clean up package.json and update @wordpress/env #180

name: Deploy to WordPress.org
on:
pull_request:
types: [closed]
branches:
- trunk
jobs:
deploy-to-wordpress:
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release/') &&
( contains(github.event.pull_request.head.ref, '/major') || contains(github.event.pull_request.head.ref, '/minor') || contains(github.event.pull_request.head.ref, '/patch') ) &&
( github.event.pull_request.user.login == 'github-actions[bot]' )
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install node dependencies
run: npm install
- name: Compile JavaScript App
run: npm run build
- name: Get New Version
id: get-version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create Tag and Release on GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=v${{ steps.get-version.outputs.VERSION }}
git tag $VERSION
git push origin $VERSION
gh release create $VERSION --generate-notes
- name: Deploy Plugin to WordPress Plugin Directory
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
VERSION: ${{ steps.get-version.outputs.VERSION }}
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}