Skip to content

Commit 0f32d35

Browse files
ifahimrezaclaude
andcommitted
ci: self-hosted zip release workflow
On a version tag (vX.Y.Z), build the production zip and publish it as a GitHub Release asset — the self-hosted download artifact. Verifies the tag matches the plugin header version before building. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 376970d commit 0f32d35

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
# Self-hosted distribution for free Saddle: on a version tag, build the
4+
# production zip and publish it as a GitHub Release asset (the downloadable
5+
# artifact). No WordPress.org / Freemius / marketplace upload involved.
6+
#
7+
# Release flow:
8+
# grunt bump:patch (or minor/major) — updates the version everywhere
9+
# git commit -am "release vX.Y.Z" && git tag vX.Y.Z && git push --follow-tags
10+
# → this workflow builds saddle-<version>.zip and attaches it to the release.
11+
12+
on:
13+
push:
14+
tags:
15+
- 'v*.*.*'
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
release:
22+
name: Build & publish zip
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Verify tag matches the plugin version
28+
run: |
29+
TAG="${GITHUB_REF_NAME#v}"
30+
HDR="$(grep -m1 -oE 'Version:[[:space:]]*[0-9.]+' saddle.php | grep -oE '[0-9.]+')"
31+
echo "tag=$TAG header=$HDR"
32+
if [ "$TAG" != "$HDR" ]; then
33+
echo "::error::Tag v$TAG does not match the plugin header version $HDR. Run 'grunt bump' and commit before tagging."
34+
exit 1
35+
fi
36+
echo "VERSION=$TAG" >> "$GITHUB_ENV"
37+
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: '20'
41+
cache: npm
42+
43+
- name: Install build tooling
44+
run: npm ci
45+
46+
- name: Build admin assets
47+
run: npm run build
48+
49+
- name: Build plugin zip
50+
run: npx grunt build
51+
52+
- name: Publish GitHub Release
53+
uses: softprops/action-gh-release@v2
54+
with:
55+
files: dist/saddle-${{ env.VERSION }}.zip
56+
fail_on_unmatched_files: true
57+
generate_release_notes: true

0 commit comments

Comments
 (0)