-
Notifications
You must be signed in to change notification settings - Fork 11
389 lines (346 loc) · 16.7 KB
/
Copy pathrelease.yml
File metadata and controls
389 lines (346 loc) · 16.7 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
name: release
# Builds every release artifact and publishes a GitHub release — replaces the
# manual scripts/release.sh + bump.sh flow. Triggers:
# • pushing a tag `vX.Y.Z` → builds that tag, publishes the release
# • manual run (workflow_dispatch) → builds the chosen ref, publishes `tag`
#
# aarch64 builds under QEMU emulation and is ~3× slower than the rest, so it is
# decoupled: the release publishes as soon as the fast artifacts are ready, and
# a follow-up job (release-aarch64) appends the aarch64 binary + arm packages
# and refreshes SHA256SUMS once that build finishes.
#
# Artifacts: agentty-linux-{x86_64,aarch64,i686}, agentty-windows-x86_64.exe,
# agentty_<v>_{amd64,arm64}.deb, agentty-<v>-1.{x86_64,aarch64}.rpm,
# agentty-bin-<v>-1-x86_64.pkg.tar.zst, agentty-<v>.tar.gz, SHA256SUMS.
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: 'Release tag to publish (e.g. v0.1.0)'
required: true
default: v0.1.0
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
# ──────────────────────────────────────────────────────────────────────────
# Fast Linux static (musl) binaries — x86_64 / i686 via Alpine (+ QEMU/386).
# ──────────────────────────────────────────────────────────────────────────
build-linux:
name: linux ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
platform: linux/amd64
cmarch: avx2
- arch: i686
platform: linux/386
cmarch: sse2
steps:
- uses: actions/checkout@v4
- name: Init maya submodule (HTTPS)
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
git submodule update --init --recursive
- name: Set up QEMU
if: matrix.platform != 'linux/amd64'
uses: docker/setup-qemu-action@v3
- name: Build static binary (Alpine 3.21 / musl / GCC 14)
run: |
docker run --rm --platform ${{ matrix.platform }} \
-e CMARCH='${{ matrix.cmarch }}' \
-v "$PWD":/src -w /src alpine:3.21 sh -c '
set -ex
apk add --no-cache build-base cmake ninja git linux-headers pkgconfig \
openssl-dev openssl-libs-static nghttp2-dev nghttp2-static zlib-static
git config --global --add safe.directory /src
rm -rf build-rel
cmake -S . -B build-rel -GNinja -DCMAKE_BUILD_TYPE=Release \
-DAGENTTY_STANDALONE=ON -DAGENTTY_FULLY_STATIC=ON \
-DAGENTTY_AUTO_PULL_MAYA=OFF -DAGENTTY_USE_MIMALLOC=OFF \
-DAGENTTY_ARCH="$CMARCH"
cmake --build build-rel -j"$(nproc)"
strip build-rel/agentty
cp build-rel/agentty agentty-linux-${{ matrix.arch }}
'
- uses: actions/upload-artifact@v4
with:
name: bin-linux-${{ matrix.arch }}
path: agentty-linux-${{ matrix.arch }}
if-no-files-found: error
# ──────────────────────────────────────────────────────────────────────────
# Slow Linux static binary — aarch64 via Alpine + QEMU. Runs independently so
# it never blocks the main release; its artifacts are appended afterwards.
# ──────────────────────────────────────────────────────────────────────────
build-linux-aarch64:
name: linux aarch64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Init maya submodule (HTTPS)
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
git submodule update --init --recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build static binary (Alpine 3.21 / musl / GCC 14)
run: |
docker run --rm --platform linux/arm64 \
-e CMARCH='native' \
-v "$PWD":/src -w /src alpine:3.21 sh -c '
set -ex
apk add --no-cache build-base cmake ninja git linux-headers pkgconfig \
openssl-dev openssl-libs-static nghttp2-dev nghttp2-static zlib-static
git config --global --add safe.directory /src
rm -rf build-rel
cmake -S . -B build-rel -GNinja -DCMAKE_BUILD_TYPE=Release \
-DAGENTTY_STANDALONE=ON -DAGENTTY_FULLY_STATIC=ON \
-DAGENTTY_AUTO_PULL_MAYA=OFF -DAGENTTY_USE_MIMALLOC=OFF \
-DAGENTTY_ARCH="$CMARCH"
cmake --build build-rel -j"$(nproc)"
strip build-rel/agentty
cp build-rel/agentty agentty-linux-aarch64
'
- uses: actions/upload-artifact@v4
with:
name: bin-linux-aarch64
path: agentty-linux-aarch64
if-no-files-found: error
# ──────────────────────────────────────────────────────────────────────────
# Windows x86_64 — MSVC + vcpkg static triplet.
# ──────────────────────────────────────────────────────────────────────────
build-windows:
name: windows x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Init maya submodule (HTTPS)
shell: bash
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
git submodule update --init --recursive
- name: Install deps (vcpkg static)
shell: pwsh
run: |
# The runner image's vcpkg ports tree can be stale/broken (e.g. the
# nghttp2 port missing its manifest); refresh + re-bootstrap first.
git -C "$env:VCPKG_INSTALLATION_ROOT" fetch --depth 1 origin master
git -C "$env:VCPKG_INSTALLATION_ROOT" reset --hard FETCH_HEAD
& "$env:VCPKG_INSTALLATION_ROOT\bootstrap-vcpkg.bat"
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install openssl nghttp2 --triplet x64-windows-static
- name: Configure + build
shell: pwsh
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release `
-DAGENTTY_STANDALONE=ON -DAGENTTY_AUTO_PULL_MAYA=OFF `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build build --config Release -j
- name: Stage binary
shell: pwsh
run: |
$exe = Get-ChildItem -Recurse build -Filter agentty.exe | Select-Object -First 1
Copy-Item $exe.FullName agentty-windows-x86_64.exe
- uses: actions/upload-artifact@v4
with:
name: bin-windows-x86_64
path: agentty-windows-x86_64.exe
if-no-files-found: error
# ──────────────────────────────────────────────────────────────────────────
# Fast Linux packages — deb (amd64) / rpm (x86_64) / Arch, from x86_64 binary.
# ──────────────────────────────────────────────────────────────────────────
package-linux:
name: packages
needs: build-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read version
id: ver
run: echo "version=$(grep -m1 'project(agentty' CMakeLists.txt | sed -E 's/.*VERSION ([0-9.]+).*/\1/')" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
name: bin-linux-x86_64
path: bins
- name: Tooling
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends rpm
- name: Build .deb (amd64)
env:
V: ${{ steps.ver.outputs.version }}
run: |
mkdir -p dist
chmod +x bins/agentty-linux-*
bash packaging/deb/build.sh "$V" amd64 bins/agentty-linux-x86_64 dist
- name: Build .rpm (x86_64)
env:
V: ${{ steps.ver.outputs.version }}
run: |
bash packaging/rpm/build.sh "$V" x86_64 bins/agentty-linux-x86_64 dist
- name: Build Arch .pkg.tar.zst (x86_64)
env:
V: ${{ steps.ver.outputs.version }}
run: |
work="$(mktemp -d)"
sed -e "s/^pkgver=.*/pkgver=$V/" \
-e "s|source_x86_64=.*|source_x86_64=(\"agentty-$V-x86_64::file:///pkg/agentty-linux-x86_64\")|" \
-e "s/sha256sums_x86_64=.*/sha256sums_x86_64=('SKIP')/" \
packaging/arch/PKGBUILD > "$work/PKGBUILD"
cp bins/agentty-linux-x86_64 "$work/agentty-linux-x86_64"
docker run --rm -v "$work":/pkg -w /pkg archlinux:base-devel bash -c '
useradd -m -u 1000 build 2>/dev/null || true
chown -R build:build /pkg
su build -c "cd /pkg && PKGDEST=/pkg makepkg -f --skipinteg --noconfirm"
'
cp "$work"/agentty-bin-*-x86_64.pkg.tar.zst dist/
- uses: actions/upload-artifact@v4
with:
name: packages
path: dist/*
if-no-files-found: error
# ──────────────────────────────────────────────────────────────────────────
# aarch64 packages — deb (arm64) / rpm (aarch64), from the aarch64 binary.
# ──────────────────────────────────────────────────────────────────────────
package-linux-aarch64:
name: packages aarch64
needs: build-linux-aarch64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read version
id: ver
run: echo "version=$(grep -m1 'project(agentty' CMakeLists.txt | sed -E 's/.*VERSION ([0-9.]+).*/\1/')" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
name: bin-linux-aarch64
path: bins
- name: Tooling
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends rpm
- name: Build .deb (arm64)
env:
V: ${{ steps.ver.outputs.version }}
run: |
mkdir -p dist
chmod +x bins/agentty-linux-*
bash packaging/deb/build.sh "$V" arm64 bins/agentty-linux-aarch64 dist
- name: Build .rpm (aarch64)
env:
V: ${{ steps.ver.outputs.version }}
run: |
bash packaging/rpm/build.sh "$V" aarch64 bins/agentty-linux-aarch64 dist
- uses: actions/upload-artifact@v4
with:
name: packages-aarch64
path: dist/*
if-no-files-found: error
# ──────────────────────────────────────────────────────────────────────────
# Publish the release as soon as the fast artifacts are ready (no aarch64).
# The full dist (minus aarch64) is re-uploaded as `release-dist` so the
# follow-up aarch64 job can rebuild a complete SHA256SUMS.
# ──────────────────────────────────────────────────────────────────────────
release:
name: publish
needs: [build-linux, build-windows, package-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Init maya submodule (HTTPS)
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
git submodule update --init --recursive
- name: Read version
id: ver
run: echo "version=$(grep -m1 'project(agentty' CMakeLists.txt | sed -E 's/.*VERSION ([0-9.]+).*/\1/')" >> "$GITHUB_OUTPUT"
- name: Resolve tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
# Explicit per-name downloads so a finished aarch64 build can't sneak in.
- uses: actions/download-artifact@v4
with: { name: bin-linux-x86_64, path: staging }
- uses: actions/download-artifact@v4
with: { name: bin-linux-i686, path: staging }
- uses: actions/download-artifact@v4
with: { name: bin-windows-x86_64, path: staging }
- uses: actions/download-artifact@v4
with: { name: packages, path: staging }
- name: Assemble dist + tarball + checksums
env:
V: ${{ steps.ver.outputs.version }}
run: |
mkdir -p dist
cp staging/agentty-linux-x86_64 staging/agentty-linux-i686 dist/
cp staging/agentty-windows-x86_64.exe dist/
cp staging/*.deb staging/*.rpm staging/*.pkg.tar.zst dist/
chmod +x dist/agentty-linux-* || true
pipx run git-archive-all "dist/agentty-${V}.tar.gz"
( cd dist && sha256sum * > SHA256SUMS )
ls -la dist
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
name: ${{ steps.tag.outputs.name }}
fail_on_unmatched_files: true
files: dist/*
# Re-upload the published dist so release-aarch64 can recompute SHA256SUMS
# over the complete set (incl. the exact same source tarball bytes).
- uses: actions/upload-artifact@v4
with:
name: release-dist
path: dist/*
if-no-files-found: error
# ──────────────────────────────────────────────────────────────────────────
# Append aarch64 artifacts to the already-published release and refresh
# SHA256SUMS. Runs after the slow aarch64 build + packaging finish.
# ──────────────────────────────────────────────────────────────────────────
release-aarch64:
name: publish aarch64
needs: [release, build-linux-aarch64, package-linux-aarch64]
runs-on: ubuntu-latest
steps:
- name: Resolve tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
# The full published dist (fast bins + windows + packages + tarball + old
# SHA256SUMS) so the regenerated checksum file covers every asset.
- uses: actions/download-artifact@v4
with: { name: release-dist, path: dist }
- uses: actions/download-artifact@v4
with: { name: bin-linux-aarch64, path: staging }
- uses: actions/download-artifact@v4
with: { name: packages-aarch64, path: staging }
- name: Add aarch64 artifacts + refresh checksums
run: |
cp staging/agentty-linux-aarch64 dist/
cp staging/*.deb staging/*.rpm dist/
chmod +x dist/agentty-linux-aarch64 || true
rm -f dist/SHA256SUMS
( cd dist && sha256sum * > SHA256SUMS )
ls -la dist
- name: Publish aarch64 assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
name: ${{ steps.tag.outputs.name }}
fail_on_unmatched_files: true
files: |
dist/agentty-linux-aarch64
dist/*arm64*.deb
dist/*aarch64*.rpm
dist/SHA256SUMS