Skip to content

Commit f90244e

Browse files
committed
Add WordPress.org deploy workflow
When a GitHub release is published, download the plugin zip from the release and deploy it to WordPress.org via SVN.
1 parent c6a59b6 commit f90244e

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/release-prepare.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
run: |
2828
# Extract version from tag (strip leading "v" if present).
2929
VERSION="${RELEASE_TAG#v}"
30+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
31+
echo "::error::Invalid version format: '$VERSION' (expected semver like '1.2.3')"
32+
exit 1
33+
fi
3034
echo "version=$VERSION" >> $GITHUB_OUTPUT
3135
3236
# Extract changelog, converting markdown list items to WP readme format.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy to WordPress.org
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
name: Deploy plugin to WordPress.org
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
14+
steps:
15+
- name: Download plugin zip from release
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
RELEASE_TAG: ${{ github.event.release.tag_name }}
19+
run: |
20+
gh release download "$RELEASE_TAG" \
21+
--repo "${{ github.repository }}" \
22+
--pattern "sqlite-database-integration.zip" \
23+
--dir .
24+
unzip sqlite-database-integration.zip
25+
26+
- name: Deploy to WordPress.org
27+
uses: 10up/action-wordpress-plugin-deploy@v2
28+
env:
29+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
30+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
31+
SLUG: sqlite-database-integration
32+
BUILD_DIR: sqlite-database-integration

0 commit comments

Comments
 (0)