Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub workflow to build and deploy standalone plugins #686

59 changes: 59 additions & 0 deletions .github/workflows/deploy-standalone-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy standalone plugins to WordPress.org

on:
push:
branches:
- trunk
- 'release/**'
paths:
- '.github/workflows/deploy-standalone-plugins.yml'
pull_request:
branches:
- trunk
- 'release/**'
- 'feature/**'
paths:
- '.github/workflows/deploy-standalone-plugins.yml'
types:
- opened
- reopened
- synchronize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you have these here for testing, but I think we'll need to change this trigger to something different like a release, or the addition of a tag, or something. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense.

Performance Lab uses:

on:
  release:
    types:
      - published

WordPress Beta Tester uses:

on:
  push:
    tags:
    - "*"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @joemcgill, Once we have thoroughly tested the workflow, we must update it with a release or push tags

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mukeshpanchal27 Can you please add both versions of the code here so that we can proceed with the full code review? You can comment out the version which we should eventually use (on release or manual dispatch), and then add a TODO comment to get rid of the current triggers here before we merge this.


jobs:
release:
name: New Release
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/checkout@v3
- id: set-matrix
run: echo "matrix="$(jq -c '{include:[keys[] as $k | {name:$k,slug:.[$k].slug,version:.[$k].version }]}' plugins.json) >> $GITHUB_OUTPUT
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/checkout@v3
- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: npm install
run: npm ci
- name: Building standalone plugins
id: build-plugins
run: npm run build-plugins
deploy:
needs: release
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.release.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Deploy Standalone Plugin - ${{ matrix.slug }}
uses: 10up/action-wordpress-plugin-deploy@stable
env:
#SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
#SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: SVN_PASSWORD
SVN_USERNAME: SVN_USERNAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these two lines commented out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because if somehow the workflow starts working, then it will not commit the code in SVN because of wrong access. I'll update it once everything is finalised. Thanks.

SLUG: ${{ matrix.slug }}
VERSION: ${{ matrix.version }}
BUILD_DIR: ./build/${{ matrix.slug }}
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved