From 147a58e12e8889ee36a66c50d53681e8da1f5a5c Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 4 May 2026 04:41:12 +0000 Subject: [PATCH] ci(release): bake ui/dist into the tagged commit so go install ships UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Today the release workflow tags main HEAD. Main's tree gitignores every file under ui/dist/ except a placeholder index.html, so a `go install github.com/RandomCodeSpace/docsiq@vX.Y.Z` resolves a tree that embeds an empty UI — the binary 404s on every /assets/* request. Fix: in the release: job, after binaries are signed but before the tag is pushed, download the ui-dist artifact, force-add ui/dist/ on a detached HEAD, commit it, then tag that ephemeral commit as $TAG and push only the tag. Main itself is never modified — only the new tag is pushed to origin. proxy.golang.org sees the tagged tree (with embedded UI), so `go install ...@vX.Y.Z` produces a working binary. Prebuilt release binaries are unaffected (they already contained the UI because CI runs `npm run build` before `go build`). --- .github/workflows/release.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa9fc91..2c1ea9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,11 @@ name: release # Manually-triggered stable release. Pick a bump (patch/minor/major) — # the next vX.Y.Z tag is computed from the latest stable tag. The `notes` # input is used verbatim as the release body and is also attached to the -# release as `CHANGELOG.md`. Nothing is committed back to the repo. +# release as `CHANGELOG.md`. An ephemeral release commit (with the built +# ui/dist/ force-added past .gitignore) is created on a detached HEAD and +# the new tag points to *that* commit, so `go install ...@vX.Y.Z` resolves +# a tree containing the embedded UI assets. Main itself is never modified +# — only the tag is pushed to origin. on: workflow_dispatch: inputs: @@ -219,12 +223,29 @@ jobs: done ls -la - - name: Create + push tag + - name: Download ui-dist for release commit + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: ui-dist + path: ui/dist + + - name: Bake ui/dist into release commit and tag it env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAG: ${{ needs.tag.outputs.tag }} run: | set -eu + # ui/dist/ is gitignored on main, so a `go install ...@TAG` + # against the main tree would embed only a placeholder + # index.html and 404 on every /assets/* request. Create an + # ephemeral commit on a detached HEAD that force-includes the + # built ui/dist/, tag that commit as $TAG, and push the tag + # only — main itself is never modified. + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git checkout --detach + git add -f ui/dist + git commit -m "release: bake ui/dist for ${TAG}" git tag "$TAG" git push origin "$TAG"