Skip to content

Commit 727d32a

Browse files
committed
feat(ci): switch release pipeline to homeboy-native release workflow
Replace the standalone release-asset.yml workflow with the homeboy continuous-release pattern used by homeboy-action and homeboy-extensions: on every push to main, check for releasable conventional commits, then run `homeboy release` to bump the version, generate the changelog, tag, push, create the GitHub Release, build the vendor-bundled ZIP via the wordpress extension's release.package action, and upload it via release.publish. The homeboy-extensions wordpress extension now provides both actions (release.package and release.publish), so we no longer need a parallel custom workflow that rebuilds the ZIP after the release event fires. The homeboy pipeline handles packaging and asset upload as part of its standard step graph (version → commit → package → git.tag → git.push → github.release → publish.wordpress). Add release_latest_branch: "release-latest" to the wordpress extension config so release.publish also mirrors the unzipped tree to a CORS-friendly branch after the release-asset upload. This unblocks WordPress Playground blueprints that hit CORS on the GitHub release-asset CDN — the world-of-wordpress blueprint can switch from releases/latest/download/data-machine-code.zip to git:directory against release-latest once the next release has populated the branch. Removes .github/workflows/release-asset.yml because the homeboy pipeline now owns ZIP production and upload. Manual asset rebuilds remain available via the workflow_dispatch on the new release.yml.
1 parent 1f73d41 commit 727d32a

3 files changed

Lines changed: 149 additions & 68 deletions

File tree

.github/workflows/release-asset.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Continuous release pipeline for Data Machine Code.
2+
#
3+
# Triggers on push to main (immediate release) and manual dispatch.
4+
# Checks for releasable conventional commits since the last tag. If found:
5+
# 1. Version bump + changelog generation
6+
# 2. Tag + push + GitHub Release creation
7+
# 3. WordPress release.package builds the vendor-bundled ZIP
8+
# 4. WordPress release.publish uploads the ZIP to the Release and
9+
# mirrors the tree to the release-latest branch (Playground CORS path)
10+
#
11+
# No human input needed — version is computed from commit types:
12+
# fix: → patch, feat: → minor, BREAKING CHANGE → major
13+
# chore:/ci:/docs:/test: → no release
14+
15+
name: Release
16+
17+
permissions:
18+
contents: write
19+
issues: write
20+
pull-requests: write
21+
22+
on:
23+
push:
24+
branches: [main]
25+
workflow_dispatch:
26+
inputs:
27+
dry-run:
28+
description: 'Preview the release without making changes'
29+
type: boolean
30+
default: false
31+
32+
jobs:
33+
# ── Step 1: Check for releasable commits ──
34+
check:
35+
name: Check for releasable commits
36+
runs-on: ubuntu-latest
37+
outputs:
38+
should-release: ${{ steps.check.outputs.should-release }}
39+
steps:
40+
- uses: actions/checkout@v6
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Restore failure cache
45+
id: failure-cache
46+
uses: actions/cache/restore@v5
47+
with:
48+
path: ${{ runner.temp }}/homeboy-release-last-failed
49+
key: release-last-failed-${{ github.ref_name }}-${{ github.sha }}
50+
restore-keys: |
51+
release-last-failed-${{ github.ref_name }}-
52+
53+
- name: Dry-run release check
54+
id: release-check
55+
uses: Extra-Chill/homeboy-action@v2
56+
with:
57+
commands: release
58+
release-dry-run: 'true'
59+
60+
- name: Decide whether to release
61+
id: check
62+
run: |
63+
HEAD_SHA="$(git rev-parse HEAD)"
64+
FAILURE_MARKER="${RUNNER_TEMP}/homeboy-release-last-failed"
65+
if [ -f "${FAILURE_MARKER}" ]; then
66+
LAST_FAILED="$(tr -d '[:space:]' < "${FAILURE_MARKER}")"
67+
if [ "${HEAD_SHA}" = "${LAST_FAILED}" ]; then
68+
echo "::notice::HEAD ${HEAD_SHA:0:8} matches last failed release attempt — skipping until new commits"
69+
echo "should-release=false" >> "$GITHUB_OUTPUT"
70+
exit 0
71+
fi
72+
fi
73+
74+
RELEASE_VERSION="${{ steps.release-check.outputs.release-version }}"
75+
BUMP_TYPE="${{ steps.release-check.outputs.release-bump-type }}"
76+
77+
if [ -z "${RELEASE_VERSION}" ]; then
78+
echo "should-release=false" >> "$GITHUB_OUTPUT"
79+
echo "::notice::No releasable commits at HEAD ${HEAD_SHA:0:8}"
80+
else
81+
echo "should-release=true" >> "$GITHUB_OUTPUT"
82+
echo "::notice::Release dry-run predicts v${RELEASE_VERSION} (${BUMP_TYPE})"
83+
fi
84+
85+
# ── Step 2: Release ──
86+
release:
87+
name: Release
88+
needs: check
89+
if: needs.check.outputs.should-release == 'true'
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Generate GitHub App token
93+
id: app-token
94+
uses: actions/create-github-app-token@v3
95+
continue-on-error: true
96+
with:
97+
app-id: ${{ secrets.HOMEBOY_APP_ID }}
98+
private-key: ${{ secrets.HOMEBOY_APP_PRIVATE_KEY }}
99+
100+
- uses: actions/checkout@v6
101+
with:
102+
fetch-depth: 0
103+
persist-credentials: false
104+
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
105+
106+
- uses: Extra-Chill/homeboy-action@v2
107+
id: release
108+
with:
109+
commands: release
110+
release-dry-run: ${{ inputs.dry-run || 'false' }}
111+
app-token: ${{ steps.app-token.outputs.token || '' }}
112+
113+
# ── Record failed SHA to prevent retry loops ──
114+
record-failure:
115+
name: Record failure
116+
needs:
117+
- check
118+
- release
119+
if: ${{ always() && needs.check.outputs.should-release == 'true' && needs.release.result == 'failure' }}
120+
runs-on: ubuntu-latest
121+
steps:
122+
- uses: actions/checkout@v6
123+
124+
- name: Save failed SHA
125+
run: git rev-parse HEAD > "${RUNNER_TEMP}/homeboy-release-last-failed"
126+
127+
- name: Cache failed SHA
128+
uses: actions/cache/save@v5
129+
with:
130+
path: ${{ runner.temp }}/homeboy-release-last-failed
131+
key: release-last-failed-${{ github.ref_name }}-${{ github.sha }}
132+
133+
# ── Clear failure cache on success ──
134+
clear-failure:
135+
name: Clear failure cache
136+
needs: release
137+
if: ${{ needs.release.result == 'success' }}
138+
runs-on: ubuntu-latest
139+
steps:
140+
- name: Clear failure cache
141+
env:
142+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
run: |
144+
gh cache list --json id,key --jq '.[] | select(.key | startswith("release-last-failed-${{ github.ref_name }}-")) | .id' | while read -r id; do
145+
gh cache delete "$id" 2>/dev/null || true
146+
done

homeboy.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"auto_cleanup": false,
33
"changelog_target": "docs/CHANGELOG.md",
44
"extensions": {
5-
"wordpress": {}
5+
"wordpress": {
6+
"release_latest_branch": "release-latest"
7+
}
68
},
79
"id": "data-machine-code",
810
"remote_path": "wp-content/plugins/data-machine-code",

0 commit comments

Comments
 (0)