Skip to content

Commit 2dd7f1c

Browse files
committed
Chain WordPress.org deploy from publish workflow
GitHub Actions does not trigger workflows from events created by GITHUB_TOKEN. Make release-wporg.yml a reusable workflow called directly from release-publish.yml, with manual dispatch support.
1 parent 61c81b8 commit 2dd7f1c

2 files changed

Lines changed: 29 additions & 10 deletions

File tree

.github/workflows/release-publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
runs-on: ubuntu-latest
2020
permissions:
2121
contents: write
22+
outputs:
23+
tag: ${{ steps.version.outputs.tag }}
24+
prerelease: ${{ steps.version.outputs.prerelease }}
2225

2326
steps:
2427
- name: Checkout repository
@@ -121,3 +124,12 @@ jobs:
121124
env:
122125
BRANCH: ${{ github.event.pull_request.head.ref }}
123126
run: git push origin --delete "$BRANCH" 2>/dev/null || true
127+
128+
deploy-wporg:
129+
name: Deploy to WordPress.org
130+
needs: publish-release
131+
if: needs.publish-release.outputs.prerelease == 'false'
132+
uses: ./.github/workflows/release-wporg.yml
133+
with:
134+
tag: ${{ needs.publish-release.outputs.tag }}
135+
secrets: inherit

.github/workflows/release-wporg.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
name: Deploy to WordPress.org
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_call:
5+
inputs:
6+
tag:
7+
required: true
8+
type: string
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: 'Tag to deploy (e.g., v2.2.21)'
13+
required: true
14+
type: string
615

716
concurrency:
8-
group: release-wporg-${{ github.event.release.tag_name }}
17+
group: release-wporg
918
cancel-in-progress: false
1019

1120
jobs:
1221
deploy:
1322
name: Deploy plugin to WordPress.org
14-
if: >-
15-
github.repository == 'WordPress/sqlite-database-integration'
16-
&& github.event.release.prerelease == false
23+
if: github.repository == 'WordPress/sqlite-database-integration'
1724
runs-on: ubuntu-latest
1825
environment: WordPress.org
1926
permissions:
@@ -29,19 +36,19 @@ jobs:
2936
- name: Download plugin zip from release
3037
env:
3138
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
RELEASE_TAG: ${{ github.event.release.tag_name }}
39+
TAG: ${{ inputs.tag }}
3340
run: |
34-
gh release download "$RELEASE_TAG" \
41+
gh release download "$TAG" \
3542
--repo "${{ github.repository }}" \
3643
--pattern "plugin-sqlite-database-integration.zip" \
3744
--dir .
3845
unzip plugin-sqlite-database-integration.zip
3946
4047
- name: Verify release metadata
4148
env:
42-
RELEASE_TAG: ${{ github.event.release.tag_name }}
49+
TAG: ${{ inputs.tag }}
4350
run: |
44-
VERSION="${RELEASE_TAG#v}"
51+
VERSION="${TAG#v}"
4552
bash bin/verify-release-metadata.sh plugin-sqlite-database-integration "$VERSION"
4653
4754
- name: Deploy to WordPress.org

0 commit comments

Comments
 (0)