From e2f5a4fb339115a65fd33cd86904b5787c9dfdf0 Mon Sep 17 00:00:00 2001 From: Ramon Corrales Date: Fri, 30 Jan 2026 09:45:38 -0500 Subject: [PATCH 1/2] add: reusable WP.org release workflow --- .github/workflows/reusable-release-wporg.yml | 58 ++++++++++++++++++++ .github/workflows/reusable-release.yml | 8 +++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/reusable-release-wporg.yml diff --git a/.github/workflows/reusable-release-wporg.yml b/.github/workflows/reusable-release-wporg.yml new file mode 100644 index 0000000..bbf2a13 --- /dev/null +++ b/.github/workflows/reusable-release-wporg.yml @@ -0,0 +1,58 @@ +# Release to WordPress.org. +# Requires the calling workflow to run reusable-release.yml first (which uploads release artifacts). +name: Release to WordPress.org + +on: + workflow_call: + inputs: + plugin-name: + description: 'WordPress.org plugin slug. Defaults to the repository name.' + required: false + type: string + default: '' + secrets: + WP_ORG_USERNAME: + required: true + WP_ORG_PASSWORD: + required: true + +jobs: + release-wporg: + name: Release to WordPress.org + runs-on: ubuntu-latest + env: + PLUGIN_NAME: ${{ inputs.plugin-name || github.event.repository.name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: npm + + - name: Install dependencies + run: npm ci --legacy-peer-deps + + - name: Download release artifacts + uses: actions/download-artifact@v4 + with: + name: release-artifacts + path: release/ + + - name: Verify release artifacts + run: | + if [ ! -d "release/$PLUGIN_NAME" ]; then + echo "::error::release/$PLUGIN_NAME not found. The release job must produce this directory via release:archive." + exit 1 + fi + + - name: Release to WordPress.org + env: + WP_ORG_USERNAME: ${{ secrets.WP_ORG_USERNAME }} + WP_ORG_PASSWORD: ${{ secrets.WP_ORG_PASSWORD }} + WP_ORG_PLUGIN_NAME: ${{ env.PLUGIN_NAME }} + run: ./node_modules/newspack-scripts/release-wporg.sh diff --git a/.github/workflows/reusable-release.yml b/.github/workflows/reusable-release.yml index 84b1fa2..cc8589e 100644 --- a/.github/workflows/reusable-release.yml +++ b/.github/workflows/reusable-release.yml @@ -51,3 +51,11 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm run release + + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + with: + name: release-artifacts + path: release/ + if-no-files-found: ignore + retention-days: 1 From 2c9120ee81ddec2db86b8ed180c902942ac78000 Mon Sep 17 00:00:00 2001 From: Ramon Corrales Date: Fri, 30 Jan 2026 10:16:49 -0500 Subject: [PATCH 2/2] fix: quote npm cache value for consistency --- .github/workflows/reusable-release-wporg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-release-wporg.yml b/.github/workflows/reusable-release-wporg.yml index bbf2a13..dba4e0c 100644 --- a/.github/workflows/reusable-release-wporg.yml +++ b/.github/workflows/reusable-release-wporg.yml @@ -32,7 +32,7 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - cache: npm + cache: 'npm' - name: Install dependencies run: npm ci --legacy-peer-deps