Skip to content

Commit 96232c6

Browse files
committed
ci: add release workflow with versioned binary names
Add a 'release' matrix job that cross-compiles via Burrito on each platform, renames the output to a versioned, platform- tagged convention, and uploads the artifacts. New naming convention (replaces ado_linux, ado_macos, etc.): ado-0.1.0-linux-x86_64 ado-0.1.0-linux-aarch64 ado-0.1.0-macos-aarch64 ado-0.1.0-macos-x86_64 ado-0.1.0-windows-x86_64.exe Changes: 1. .github/workflows/ci.yml: - Trigger release on push to main OR on tag push (v*). - 5-way matrix (linux x86_64, linux arm64, macos aarch64, macos x86_64, windows x86_64) running on native runners. - Rename step normalizes Burrito's ado_<target>{,.exe} output to the stable ado-<version>-<os>-<arch>{,.exe} form. - Smoke test runs each binary's --version or --help. - Artifacts uploaded per-platform with 90-day retention. 2. .github/workflows/ci.yml (release-attach job): - Runs on tag push only. - Downloads all release artifacts, creates a GitHub Release with a markdown table of all supported platforms. - Attaches every binary to the release. 3. justfile: - release / release-fast now call release-rename after mix release - New 'release-rename' recipe (also callable standalone) reads version from mix.exs and maps Burrito target names to {os}-{arch} suffixes. Used by both the justfile and CI. 4. bin/sign.sh: - Looks up the renamed binary (ado-<version>-macos-aarch64) first, falls back to legacy ado_macos for older artifacts. - Bash syntax checked. Verified locally: just release-rename produces the expected filenames; the renamed macOS binary runs './ado --help' cleanly. 162 tests pass. mix ci green. actionlint clean.
1 parent d348c81 commit 96232c6

3 files changed

Lines changed: 234 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
on:
44
push:
55
branches: [main, "feature/*", "fix/*"]
6+
tags: ["v*"]
67
pull_request:
78
branches: [main]
89
workflow_dispatch:
@@ -176,3 +177,183 @@ jobs:
176177
echo "Linux result: ${{ needs.linux.result }}"
177178
echo "macOS result: ${{ needs.macos.result }}"
178179
exit 1
180+
181+
# ── Release build: cross-compile via Burrito, rename, upload artifacts ─
182+
release:
183+
name: "Release · Burrito · ${{ matrix.label }}"
184+
# Only build releases on pushes to main (not on PRs) and on tag pushes.
185+
# Use workflow_dispatch to trigger manually for ad-hoc builds.
186+
if: |
187+
github.event_name == 'push' &&
188+
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
189+
needs: [ci-status]
190+
runs-on: ${{ matrix.os }}
191+
timeout-minutes: 30
192+
strategy:
193+
# Don't cancel other platforms if one fails — we want all
194+
# binaries even if e.g. macOS signing fails.
195+
fail-fast: false
196+
matrix:
197+
include:
198+
- os: ubuntu-latest
199+
target: linux
200+
cpu: x86_64
201+
ext: ""
202+
label: "Linux x86_64"
203+
artifact: ado-linux-x86_64
204+
- os: ubuntu-latest
205+
target: linux_arm
206+
cpu: aarch64
207+
ext: ""
208+
label: "Linux ARM64"
209+
artifact: ado-linux-aarch64
210+
- os: macos-latest
211+
target: macos
212+
cpu: aarch64
213+
ext: ""
214+
label: "macOS Apple Silicon"
215+
artifact: ado-macos-aarch64
216+
- os: macos-latest
217+
target: macos_x86
218+
cpu: x86_64
219+
ext: ""
220+
label: "macOS Intel"
221+
artifact: ado-macos-x86_64
222+
- os: windows-latest
223+
target: windows
224+
cpu: x86_64
225+
ext: ".exe"
226+
label: "Windows x86_64"
227+
artifact: ado-windows-x86_64
228+
229+
steps:
230+
- uses: actions/checkout@v4
231+
232+
- name: Set up Elixir
233+
uses: erlef/setup-beam@v1
234+
with:
235+
otp-version: ${{ env.OTP_VERSION }}
236+
elixir-version: ${{ env.ELIXIR_VERSION }}
237+
238+
- name: Cache build artifacts
239+
uses: actions/cache@v4
240+
with:
241+
path: |
242+
_build
243+
deps
244+
priv/plts
245+
key: release-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}
246+
restore-keys: |
247+
release-${{ runner.os }}-
248+
249+
- name: Install dependencies
250+
run: mix deps.get
251+
252+
- name: Build Burrito release
253+
env:
254+
MIX_ENV: prod
255+
# Burrito writes binaries to burrito_out/<target-key> by
256+
# convention. We rename the output below to a stable,
257+
# versioned name.
258+
run: |
259+
mkdir -p release_bin
260+
mix release --overwrite --target ${{ matrix.target }}
261+
ls -lh burrito_out/
262+
263+
- name: Get version
264+
id: version
265+
run: |
266+
# Read the version from mix.exs so the release artifact name
267+
# always matches the source of truth.
268+
VERSION=$(grep -E '^\s*version:\s*"' mix.exs | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
269+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
270+
271+
- name: Rename binary
272+
# Normalize the binary name to:
273+
# ado-<version>-<os>-<arch><.exe?>
274+
# e.g. ado-0.1.0-macos-aarch64
275+
# ado-0.1.0-linux-x86_64
276+
# ado-0.1.0-windows-x86_64.exe
277+
run: |
278+
set -euo pipefail
279+
VERSION="${{ steps.version.outputs.version }}"
280+
# Map matrix.target to a clean {os}-{arch} string
281+
case "${{ matrix.target }}" in
282+
linux) SUFFIX="linux-x86_64" ;;
283+
linux_arm) SUFFIX="linux-aarch64" ;;
284+
macos) SUFFIX="macos-aarch64" ;;
285+
macos_x86) SUFFIX="macos-x86_64" ;;
286+
windows) SUFFIX="windows-x86_64" ;;
287+
*) echo "::error::Unknown target ${{ matrix.target }}"; exit 1 ;;
288+
esac
289+
OUT_NAME="ado-${VERSION}-${SUFFIX}${{ matrix.ext }}"
290+
SRC="burrito_out/ado_${{ matrix.target }}${{ matrix.ext }}"
291+
DEST="release_bin/${OUT_NAME}"
292+
if [[ ! -f "${SRC}" ]]; then
293+
echo "::error::Expected Burrito output not found: ${SRC}"
294+
ls -lh burrito_out/
295+
exit 1
296+
fi
297+
mv "${SRC}" "${DEST}"
298+
chmod +x "${DEST}"
299+
echo "Renamed ${SRC} -> ${DEST}"
300+
ls -lh release_bin/
301+
302+
- name: Smoke test the binary
303+
run: |
304+
set -euo pipefail
305+
# Glob is intentional here — there's exactly one file in
306+
# the dir, but actionlint warns about unquoted globs.
307+
BINARY=$(ls release_bin/ado-*)
308+
echo "Testing $BINARY"
309+
"$BINARY" --version || "$BINARY" --help | head -20
310+
311+
- name: Upload release binary
312+
uses: actions/upload-artifact@v4
313+
with:
314+
name: ${{ matrix.artifact }}
315+
path: release_bin/ado-*
316+
retention-days: 90
317+
if-no-files-found: error
318+
319+
# ── Attach binaries to GitHub Release on tag push ──────────────────
320+
release-attach:
321+
name: Publish GitHub Release
322+
if: startsWith(github.ref, 'refs/tags/')
323+
needs: [release]
324+
runs-on: ubuntu-latest
325+
permissions:
326+
contents: write
327+
steps:
328+
- uses: actions/download-artifact@v4
329+
with:
330+
path: dist/
331+
merge-multiple: true
332+
333+
- name: Display downloaded artifacts
334+
run: ls -lh dist/
335+
336+
- name: Create GitHub Release
337+
uses: softprops/action-gh-release@v2
338+
with:
339+
tag_name: ${{ github.ref_name }}
340+
name: "AdoCli ${{ github.ref_name }}"
341+
body: |
342+
## AdoCli ${{ github.ref_name }}
343+
344+
Pre-built binaries for all supported platforms.
345+
346+
| Platform | Architecture | Binary |
347+
|----------|--------------|--------|
348+
| Linux | x86_64 | `ado-*-linux-x86_64` |
349+
| Linux | aarch64 | `ado-*-linux-aarch64` |
350+
| macOS | Apple Silicon | `ado-*-macos-aarch64` |
351+
| macOS | Intel | `ado-*-macos-x86_64` |
352+
| Windows | x86_64 | `ado-*-windows-x86_64.exe` |
353+
354+
See [README.md](https://github.com/gilbertwong96/ado_cli) for
355+
installation instructions.
356+
draft: false
357+
prerelease: false
358+
files: |
359+
dist/ado-*

bin/sign.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,22 @@ set -euo pipefail
3636

3737
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
3838
BURRITO_OUT="$ROOT/burrito_out"
39-
BINARY="$BURRITO_OUT/ado_macos"
39+
# Use the renamed binary (versioned, e.g. ado-0.1.0-macos-aarch64).
40+
# If only the legacy Burrito name is present (ado_macos), use that as
41+
# a fallback so the script keeps working on older release artifacts.
42+
VERSION=$(grep -E '^\s*version:\s*"' "$ROOT/mix.exs" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
43+
NEW_BINARY="$BURRITO_OUT/ado-${VERSION}-macos-aarch64"
44+
LEGACY_BINARY="$BURRITO_OUT/ado_macos"
45+
if [[ -f "$NEW_BINARY" ]]; then
46+
BINARY="$NEW_BINARY"
47+
elif [[ -f "$LEGACY_BINARY" ]]; then
48+
BINARY="$LEGACY_BINARY"
49+
else
50+
printf '\033[1;31mxx macOS binary not found: tried %s and %s\033[0m\n' \
51+
"$NEW_BINARY" "$LEGACY_BINARY" >&2
52+
printf ' Run '\''just release'\'' first.\n' >&2
53+
exit 1
54+
fi
4055

4156
MACOS_SIGN_IDENTITY="${MACOS_SIGN_IDENTITY:-}"
4257
MACOS_KEYCHAIN_PROFILE="${MACOS_KEYCHAIN_PROFILE:-}"

justfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,21 @@ run +args:
4747
# ── Burrito Release ────────────────────────────────────────────────────
4848

4949
# Build Burrito release for all targets (clears cache first)
50+
# Output: burrito_out/ado_<target>{,.exe}, then renames to
51+
# burrito_out/ado-<version>-<os>-<arch>{,.exe} for stable naming.
5052
release:
5153
rm -rf ~/Library/Application\ Support/.burrito/ado*
5254
rm -rf _build/prod
5355
MIX_ENV=prod mix release --overwrite
56+
@just release-rename
5457
@echo "→ burrito_out/"
5558

5659
# Build Burrito release without clearing cache (faster, for minor changes)
5760
release-fast:
5861
rm -rf _build/prod
5962
MIX_ENV=prod mix release --overwrite
63+
@just release-rename
64+
@echo "→ burrito_out/"
6065

6166
# Clear Burrito cache only
6267
release-clean:
@@ -66,6 +71,38 @@ release-clean:
6671
release-list:
6772
@ls -lh burrito_out/
6873

74+
# Rename Burrito's ado_<target>{,.exe} binaries to the versioned,
75+
# platform-tagged naming convention used by the CI release workflow:
76+
# ado-<version>-linux-x86_64
77+
# ado-<version>-linux-aarch64
78+
# ado-<version>-macos-aarch64
79+
# ado-<version>-macos-x86_64
80+
# ado-<version>-windows-x86_64.exe
81+
# Original Burrito outputs are removed.
82+
release-rename:
83+
#!/usr/bin/env bash
84+
set -euo pipefail
85+
VERSION=$(grep -E '^\s*version:\s*"' mix.exs | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
86+
for src in burrito_out/ado_*; do
87+
[[ -f "$src" ]] || continue
88+
base=$(basename "$src")
89+
ext=""
90+
[[ "$base" == *.exe ]] && ext=".exe"
91+
key="${base%.exe}"
92+
key="${key#ado_}"
93+
case "$key" in
94+
linux) SUFFIX="linux-x86_64" ;;
95+
linux_arm) SUFFIX="linux-aarch64" ;;
96+
macos) SUFFIX="macos-aarch64" ;;
97+
macos_x86) SUFFIX="macos-x86_64" ;;
98+
windows) SUFFIX="windows-x86_64" ;;
99+
*) echo "::warn::Unknown Burrito target: $key (no rename rule)"; continue ;;
100+
esac
101+
dest="burrito_out/ado-${VERSION}-${SUFFIX}${ext}"
102+
mv "$src" "$dest"
103+
echo "renamed $src -> $dest"
104+
done
105+
69106
# Build, sign, and notarize the macOS binary. See bin/sign.sh for env vars.
70107
release-macos:
71108
@just release

0 commit comments

Comments
 (0)