Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/reusable-release-wporg.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .github/workflows/reusable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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