feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a24242ab70
commit
07e57a5d41
3 changed files with 121 additions and 7 deletions
|
|
@ -24,6 +24,9 @@ publishers:
|
|||
- type: github
|
||||
prerelease: false
|
||||
draft: false
|
||||
- type: homebrew
|
||||
tap: host-uk/homebrew-tap
|
||||
formula: core
|
||||
|
||||
changelog:
|
||||
include:
|
||||
|
|
|
|||
110
.github/workflows/alpha-release.yml
vendored
110
.github/workflows/alpha-release.yml
vendored
|
|
@ -58,20 +58,37 @@ jobs:
|
|||
run: |
|
||||
EXT=""
|
||||
if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi
|
||||
go build -o "./bin/core${EXT}" .
|
||||
BINARY="core${EXT}"
|
||||
ARCHIVE_PREFIX="core-${GOOS}-${GOARCH}"
|
||||
|
||||
go build -ldflags "-s -w" -o "./bin/${BINARY}" .
|
||||
|
||||
# Create tar.gz for Homebrew (non-Windows)
|
||||
if [ "$GOOS" != "windows" ]; then
|
||||
tar czf "./bin/${ARCHIVE_PREFIX}.tar.gz" -C ./bin "${BINARY}"
|
||||
fi
|
||||
|
||||
# Rename raw binary to platform-specific name for release
|
||||
mv "./bin/${BINARY}" "./bin/${ARCHIVE_PREFIX}${EXT}"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: core-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: ./bin/core*
|
||||
path: ./bin/core-*
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set version
|
||||
id: version
|
||||
run: echo "version=v${{ env.NEXT_VERSION }}-alpha.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
|
|
@ -87,9 +104,8 @@ jobs:
|
|||
- name: Create alpha release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
VERSION="v${{ env.NEXT_VERSION }}-alpha.${{ github.run_number }}"
|
||||
|
||||
gh release create "$VERSION" \
|
||||
--title "Alpha: $VERSION" \
|
||||
--notes "Canary build from dev branch.
|
||||
|
|
@ -110,7 +126,10 @@ jobs:
|
|||
## Installation
|
||||
|
||||
\`\`\`bash
|
||||
# macOS/Linux
|
||||
# Homebrew (macOS/Linux)
|
||||
brew install host-uk/tap/core
|
||||
|
||||
# Direct download (example: Linux amd64)
|
||||
curl -fsSL https://github.com/host-uk/core/releases/download/$VERSION/core-linux-amd64 -o core
|
||||
chmod +x core && sudo mv core /usr/local/bin/
|
||||
\`\`\`
|
||||
|
|
@ -118,3 +137,84 @@ jobs:
|
|||
--prerelease \
|
||||
--target dev \
|
||||
release/*
|
||||
|
||||
update-tap:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate checksums
|
||||
run: |
|
||||
cd dist
|
||||
for f in *.tar.gz; do
|
||||
sha256sum "$f" | awk '{print $1}' > "${f}.sha256"
|
||||
done
|
||||
echo "=== Checksums ==="
|
||||
cat *.sha256
|
||||
|
||||
- name: Update Homebrew formula
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ needs.release.outputs.version }}
|
||||
run: |
|
||||
# Strip leading 'v' for formula version
|
||||
FORMULA_VERSION="${VERSION#v}"
|
||||
|
||||
# Read checksums
|
||||
DARWIN_ARM64=$(cat dist/core-darwin-arm64.tar.gz.sha256)
|
||||
LINUX_AMD64=$(cat dist/core-linux-amd64.tar.gz.sha256)
|
||||
LINUX_ARM64=$(cat dist/core-linux-arm64.tar.gz.sha256)
|
||||
|
||||
# Clone tap repo
|
||||
gh repo clone host-uk/homebrew-tap /tmp/tap -- --depth=1
|
||||
mkdir -p /tmp/tap/Formula
|
||||
|
||||
# Write formula
|
||||
cat > /tmp/tap/Formula/core.rb << FORMULA
|
||||
# typed: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Core < Formula
|
||||
desc "Host UK development CLI"
|
||||
homepage "https://github.com/host-uk/core"
|
||||
version "${FORMULA_VERSION}"
|
||||
license "EUPL-1.2"
|
||||
|
||||
on_macos do
|
||||
url "https://github.com/host-uk/core/releases/download/${VERSION}/core-darwin-arm64.tar.gz"
|
||||
sha256 "${DARWIN_ARM64}"
|
||||
end
|
||||
|
||||
on_linux do
|
||||
if Hardware::CPU.arm?
|
||||
url "https://github.com/host-uk/core/releases/download/${VERSION}/core-linux-arm64.tar.gz"
|
||||
sha256 "${LINUX_ARM64}"
|
||||
else
|
||||
url "https://github.com/host-uk/core/releases/download/${VERSION}/core-linux-amd64.tar.gz"
|
||||
sha256 "${LINUX_AMD64}"
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
bin.install "core"
|
||||
end
|
||||
|
||||
test do
|
||||
system "\#{bin}/core", "--version"
|
||||
end
|
||||
end
|
||||
FORMULA
|
||||
|
||||
# Remove leading whitespace from heredoc
|
||||
sed -i 's/^ //' /tmp/tap/Formula/core.rb
|
||||
|
||||
cd /tmp/tap
|
||||
git add .
|
||||
git diff --cached --quiet && echo "No changes to tap" && exit 0
|
||||
git commit -m "Update core to ${FORMULA_VERSION}"
|
||||
git push
|
||||
|
|
|
|||
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
|
|
@ -53,13 +53,24 @@ jobs:
|
|||
run: |
|
||||
EXT=""
|
||||
if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi
|
||||
go build -o "./bin/core${EXT}" .
|
||||
BINARY="core${EXT}"
|
||||
ARCHIVE_PREFIX="core-${GOOS}-${GOARCH}"
|
||||
|
||||
go build -ldflags "-s -w" -o "./bin/${BINARY}" .
|
||||
|
||||
# Create tar.gz for Homebrew (non-Windows)
|
||||
if [ "$GOOS" != "windows" ]; then
|
||||
tar czf "./bin/${ARCHIVE_PREFIX}.tar.gz" -C ./bin "${BINARY}"
|
||||
fi
|
||||
|
||||
# Rename raw binary to platform-specific name for release
|
||||
mv "./bin/${BINARY}" "./bin/${ARCHIVE_PREFIX}${EXT}"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: core-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: ./bin/core*
|
||||
path: ./bin/core-*
|
||||
|
||||
release:
|
||||
needs: build
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue