From e1923095e183d251276e18f7ca83b4b260d23151 Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 5 Feb 2026 01:21:18 +0000 Subject: [PATCH] fix(release): set AppVersion ldflags, git config, and tap token - Set -X pkg/cli.AppVersion in ldflags so core --version reports the correct version instead of "dev" - Add git config user.name/email in update-tap job so commit succeeds - Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo push to host-uk/homebrew-tap Co-Authored-By: Claude Opus 4.5 --- .github/workflows/alpha-release.yml | 7 +++++-- .github/workflows/release.yml | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/alpha-release.yml b/.github/workflows/alpha-release.yml index b41eb221..1dabad9d 100644 --- a/.github/workflows/alpha-release.yml +++ b/.github/workflows/alpha-release.yml @@ -61,7 +61,8 @@ jobs: BINARY="core${EXT}" ARCHIVE_PREFIX="core-${GOOS}-${GOARCH}" - go build -ldflags "-s -w" -o "./bin/${BINARY}" . + APP_VERSION="${{ env.NEXT_VERSION }}-alpha.${{ github.run_number }}" + go build -ldflags "-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${APP_VERSION}" -o "./bin/${BINARY}" . # Create tar.gz for Homebrew (non-Windows) if [ "$GOOS" != "windows" ]; then @@ -159,7 +160,7 @@ jobs: - name: Update Homebrew formula env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} VERSION: ${{ needs.release.outputs.version }} run: | # Strip leading 'v' for formula version @@ -214,6 +215,8 @@ jobs: sed -i 's/^ //' /tmp/tap/Formula/core.rb cd /tmp/tap + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" git add . git diff --cached --quiet && echo "No changes to tap" && exit 0 git commit -m "Update core to ${FORMULA_VERSION}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5add9d4d..5a2bdbd0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,8 @@ jobs: BINARY="core${EXT}" ARCHIVE_PREFIX="core-${GOOS}-${GOARCH}" - go build -ldflags "-s -w" -o "./bin/${BINARY}" . + APP_VERSION="${GITHUB_REF_NAME#v}" + go build -ldflags "-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${APP_VERSION}" -o "./bin/${BINARY}" . # Create tar.gz for Homebrew (non-Windows) if [ "$GOOS" != "windows" ]; then