-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (209 loc) · 7.5 KB
/
Copy pathrelease.yml
File metadata and controls
239 lines (209 loc) · 7.5 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Release
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
id-token: write
pull-requests: write
jobs:
changesets:
name: Changesets gate
runs-on: ubuntu-latest
outputs:
has_changesets: ${{ steps.changesets.outputs.hasChangesets }}
should_release: ${{ steps.agenter-release.outputs.should_release }}
version: ${{ steps.agenter-release.outputs.version }}
tag: ${{ steps.agenter-release.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node for npm trusted publishing
uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Install npm with trusted publishing support
run: npm install -g "npm@^11.10.0"
- name: Verify release toolchain
run: |
node --version
npm --version
bun --version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Create version PR when changesets exist
id: changesets
uses: changesets/action@v1
with:
version: bun run version-packages
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve release identity and publish gate
id: agenter-release
shell: bash
run: |
set -euo pipefail
version="$(node -e "process.stdout.write(JSON.parse(require('fs').readFileSync('packages/agenter/package.json','utf8')).version)")"
tag="v${version}"
should_release=false
if [ "${{ steps.changesets.outputs.hasChangesets }}" = "false" ]; then
if ! npm view "agenter@${version}" version --json >/dev/null 2>&1; then
should_release=true
fi
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "should_release=${should_release}" >> "$GITHUB_OUTPUT"
native-artifacts:
name: Native artifacts (${{ matrix.target }})
needs: changesets
if: ${{ needs.changesets.outputs.has_changesets == 'false' && needs.changesets.outputs.should_release == 'true' }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: darwin-arm64
runner: macos-15
- target: darwin-x64
runner: macos-15-intel
- target: linux-arm64
runner: ubuntu-24.04-arm
- target: linux-x64
runner: ubuntu-24.04
- target: windows-arm64
runner: windows-11-arm
- target: windows-x64
runner: windows-2025
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build ghostty-native artifact
shell: bash
run: |
set -euo pipefail
bash packages/ghostty-native/build/build.sh
mkdir -p native-artifacts
cp packages/ghostty-native/termless-ghostty-native.node native-artifacts/
- name: Upload native artifacts
uses: actions/upload-artifact@v4
with:
name: ghostty-native-${{ matrix.target }}
path: native-artifacts/termless-ghostty-native.node
if-no-files-found: error
release:
name: Publish canonical archives, npm packages, and Homebrew projection
needs:
- changesets
- native-artifacts
if: ${{ needs.changesets.outputs.has_changesets == 'false' && needs.changesets.outputs.should_release == 'true' }}
runs-on: ubuntu-latest
environment: npm-release
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node for npm trusted publishing
uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- name: Install npm with trusted publishing support
run: npm install -g "npm@^11.10.0"
- name: Verify release toolchain
run: |
node --version
npm --version
bun --version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Download native artifacts
uses: actions/download-artifact@v4
with:
pattern: ghostty-native-*
path: native-artifacts
- name: Stage ghostty-native artifacts into npm packages
shell: bash
run: |
set -euo pipefail
for target in darwin-arm64 darwin-x64 linux-arm64 linux-x64 windows-arm64 windows-x64; do
package_os="${target%-*}"
arch="${target##*-}"
if [ "$package_os" = "windows" ]; then
package_os="win32"
fi
bun run scripts/binaries/stage-local.ts \
--source "native-artifacts/ghostty-native-${target}/termless-ghostty-native.node" \
--package-os "$package_os" \
--arch "$arch"
done
- name: Validate ghostty-native publish package contents
shell: bash
run: |
set -euo pipefail
for package_dir in \
packages/ghostty-native \
packages/ghostty-native-darwin-arm64 \
packages/ghostty-native-darwin-x64 \
packages/ghostty-native-linux-arm64-gnu \
packages/ghostty-native-linux-x64-gnu \
packages/ghostty-native-win32-arm64-msvc \
packages/ghostty-native-win32-x64-msvc
do
npm pack --dry-run --json "./${package_dir}" >/dev/null
done
- name: Release preflight
run: bun run release:preflight --skip-install
- name: Prepare release packages from canonical archive truth
run: bun run release:prepare-packages
- name: Publish canonical GitHub release archives
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.changesets.outputs.tag }}
name: agenter ${{ needs.changesets.outputs.tag }}
target_commitish: ${{ github.sha }}
files: |
release-archives/agenter-cli/*.tar.gz
release-archives/agenter-cli/*.zip
release-archives/agenter-cli/*.sha256
release-archives/agenter-cli/agenter-release-archives.json
fail_on_unmatched_files: true
overwrite_files: true
- name: Publish npm packages from prepared release truth
run: |
bun run release:publish-bundles
bun run release:verify-published
- name: Generate Homebrew projection
run: |
bun run homebrew:generate-formula -- \
--manifest release-archives/agenter-cli/agenter-release-archives.json \
--output-dir homebrew-projection
- name: Project Homebrew tap when external repo auth is configured
shell: bash
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
run: |
set -euo pipefail
if [ -z "${GH_TOKEN:-}" ]; then
echo "HOMEBREW_TAP_GITHUB_TOKEN is not configured; skipping Homebrew tap projection."
exit 0
fi
bun run homebrew:bootstrap-tap -- --projection-dir homebrew-projection