-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (75 loc) · 3.1 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (75 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
# Same self-hosted mini as ci.yml: the persistent Bazel disk cache is what
# keeps the -c opt LLVM build from approaching GitHub's job cap (a cold
# hosted runner rebuilds the patched llvm-project from source every tag).
# The runner executes one job at a time, so a release queues behind any
# in-flight CI run instead of contending with it.
runs-on: [self-hosted, macOS, ARM64]
timeout-minutes: 180
env:
# Must match the .bazelrc --xcode_version pin.
DEVELOPER_DIR: /Applications/Xcode-26.2.0.app/Contents/Developer
steps:
- uses: actions/checkout@v7
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
# release_tarball packages the binary WITH its runfiles tree
# (PreviewAgent, orc runtime, iOS JIT resources) — a bare binary's
# render path throws at runtime (#366).
- name: Build release tarball
run: bazel build -c opt //previewsmcp/cli:release_tarball
- name: Stage versioned artifact
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
STAGING="previewsmcp-${VERSION}-darwin-arm64"
cp -f bazel-bin/previewsmcp/cli/previewsmcp-darwin-arm64.tar.gz "${STAGING}.tar.gz"
shasum -a 256 "${STAGING}.tar.gz" > "${STAGING}.tar.gz.sha256"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
STAGING="previewsmcp-${VERSION}-darwin-arm64"
gh release create "v${VERSION}" \
"${STAGING}.tar.gz" \
"${STAGING}.tar.gz.sha256" \
--title "v${VERSION}" \
--generate-notes
- name: Update Homebrew tap
env:
VERSION: ${{ steps.version.outputs.VERSION }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
echo "HOMEBREW_TAP_TOKEN not set, skipping Homebrew tap update"
exit 0
fi
STAGING="previewsmcp-${VERSION}-darwin-arm64"
SHA256="$(awk '{print $1}' "${STAGING}.tar.gz.sha256")"
URL="https://github.com/obj-p/PreviewsMCP/releases/download/v${VERSION}/${STAGING}.tar.gz"
bash scripts/generate-formula.sh "$VERSION" "$URL" "$SHA256" > previewsmcp.rb
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/obj-p/homebrew-tap.git" tap-repo
mkdir -p tap-repo/Formula
cp previewsmcp.rb tap-repo/Formula/previewsmcp.rb
cd tap-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/previewsmcp.rb
if git diff --cached --quiet; then
echo "Formula already up to date"
exit 0
fi
git commit -m "previewsmcp ${VERSION}"
git push origin main