-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (101 loc) · 3.54 KB
/
release.yml
File metadata and controls
118 lines (101 loc) · 3.54 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
build:
name: build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: target/release/loopforge
- os: macos-15-intel
target: x86_64-apple-darwin
bin: target/release/loopforge
- os: macos-14
target: aarch64-apple-darwin
bin: target/release/loopforge
- os: windows-latest
target: x86_64-pc-windows-msvc
bin: target/release/loopforge.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Verify release metadata consistency
run: python scripts/verify_release_consistency.py --tag "${{ github.ref_name }}"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Build (release)
run: cargo build --release -p loopforge-cli --locked --features bedrock
- name: Package
run: python scripts/package_release.py --version "${{ github.ref_name }}" --target "${{ matrix.target }}" --bin "${{ matrix.bin }}" --out-dir dist
- name: Smoke test packaged binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
version="${{ github.ref_name }}"
base="loopforge-${version}-${{ matrix.target }}"
archive="dist/${base}.tar.gz"
rm -rf smoke
mkdir -p smoke
tar -xzf "${archive}" -C smoke
bin="smoke/${base}/loopforge"
"${bin}" --help >/dev/null
doctor_json="$("${bin}" doctor --json --timeout-ms 200)"
printf '%s' "${doctor_json}" | python3 -c "import json,sys; data=json.load(sys.stdin); assert 'summary' in data and 'checks' in data"
- name: Smoke test packaged binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$version = "${{ github.ref_name }}"
$base = "loopforge-$version-${{ matrix.target }}"
$archive = "dist/$base.zip"
if (!(Test-Path $archive)) { throw "missing archive: $archive" }
Remove-Item -Recurse -Force smoke -ErrorAction SilentlyContinue
Expand-Archive -Path $archive -DestinationPath smoke -Force
$bin = "smoke/$base/loopforge.exe"
& $bin --help | Out-Null
$doctor = & $bin doctor --json --timeout-ms 200
$parsed = $doctor | ConvertFrom-Json
if ($null -eq $parsed.summary -or $null -eq $parsed.checks) {
throw "doctor json missing summary/checks"
}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.target }}
path: |
dist/*.tar.gz
dist/*.zip
dist/*.sha256
if-no-files-found: error
publish:
name: publish (github release)
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List assets
run: ls -la dist
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/**
generate_release_notes: true