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

Enhancement/resolve release deploy action warnings #97

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# TODO: THIS WORKFLOW FILE IS TO TEST ISSUE #60 "Resolve release deploy action warnings"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the Deploy to Wordpress.org Github action only runs on the publish event I've added a separate file that comments out the WordPress Plugin Deploy step and generates the zip file for the replaced step last.

This can be deleted once the PR passes code review and QA.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Tested and looks good to me so feel free to delete this file and I can move this along to UAT

# DELETE AFTER TESTING IS COMPLETE. THIS WORKFLOW FILE IS UNNECESSARY.

name: (delete after testing is done) - Test "Deploy to WordPress.org"

on:
# TESTING: Commented out to avoid running on the published event by mistake
# release:
# types: [published]

# TESTING: Draft a release and then run the workflow file manually
workflow_dispatch:
inputs:
tag:
description: 'The tag for the release (e.g., v1.0.0)'
required: true

jobs:
tag:
name: New release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node version and npm cache
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Build
run: |
npm ci --no-optional
npm run build

- name: Install SVN
run: |
sudo apt-get update
sudo apt-get install subversion

# TESTING: COMMENTED OUT TO AVOID DEPLOY TO WORDPRESS.ORG DURING TESTING

# - name: WordPress Plugin Deploy
# id: deploy
# uses: 10up/action-wordpress-plugin-deploy@stable
# with:
# generate-zip: true
# env:
# SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
# SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
# SLUG: mailchimp

# TESTING: Generate the WordPress Plugin zip file without deploying
- name: Generate Plugin Zip File For Testing (skip deploy to WordPress.org)
id: deploy
run: |
# Create a zip file for the plugin
mkdir -p build
zip -r build/mailchimp.zip . -x "*.git*" "node_modules/*" "tests/*"
env:
SLUG: mailchimp

- name: Update GitHub release with built plugin files
uses: softprops/action-gh-release@v2
with:
# files: ${{ steps.deploy.outputs.zip-path }} # TESTING: Original zip file source
files: build/mailchimp.zip # TESTING: Get zip file from generate plugin step
tag_name: ${{ github.event.inputs.tag }} # Pass the tag from workflow_dispatch input
body: |
This release contains the latest updates for the WordPress plugin.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 7 additions & 7 deletions .github/workflows/wordpress-plugin-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
tag:
name: New release
runs-on: ubuntu-latest
if: ${{ !github.event.release.prerelease }} # Skip job if it is a pre-release

steps:
- name: Checkout code
Expand Down Expand Up @@ -39,12 +40,11 @@ jobs:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: mailchimp

- name: Upload release asset
uses: actions/[email protected]
- name: Attach the wordpress.org plugin files to the Github release
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.deploy.outputs.zip-path }}
body: |
This release contains the latest updates for the WordPress plugin.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip-path }}
asset_name: mailchimp.zip
asset_content_type: application/zip
Loading