development
yml 85 lines 3.14 KB
Raw
1 name: release
2
3 on:
4 push:
5 tags: ["v*"]
6
7 permissions:
8 contents: write
9
10 jobs:
11 build:
12 strategy:
13 fail-fast: false
14 matrix:
15 include:
16 - { target: aarch64-apple-darwin, os: macos-latest, name: darwin-arm64 }
17 - { target: x86_64-apple-darwin, os: macos-15-intel, name: darwin-x64 }
18 - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, name: linux-x64 }
19 - { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04-arm, name: linux-arm64 }
20 - { target: x86_64-pc-windows-msvc, os: windows-latest, name: windows-x64 }
21 runs-on: ${{ matrix.os }}
22 steps:
23 - uses: actions/checkout@v5
24 - uses: dtolnay/rust-toolchain@stable
25 with:
26 targets: ${{ matrix.target }}
27 - run: cargo build --release --locked --bin splitfire-agent --target ${{ matrix.target }}
28 # The exe must not import the VC++ runtime DLLs (see .cargo/config.toml), or it fails to
29 # load on a machine without the redistributable.
30 - name: Check static CRT
31 if: matrix.os == 'windows-latest'
32 shell: pwsh
33 run: ./packaging/windows/check-static-crt.ps1 -Path target/${{ matrix.target }}/release/splitfire-agent.exe
34 - name: Package archive
35 shell: bash
36 run: |
37 ARCHIVE=splitfire-agent-${{ matrix.name }}
38 if [ "${{ matrix.os }}" = "windows-latest" ]; then
39 # exe at the zip root, matching RelativeFilePath in the winget manifest
40 (cd "target/${{ matrix.target }}/release" && 7z a "$GITHUB_WORKSPACE/$ARCHIVE.zip" splitfire-agent.exe)
41 echo "asset=$ARCHIVE.zip" >> "$GITHUB_ENV"
42 else
43 tar -czf "$ARCHIVE.tar.gz" -C "target/${{ matrix.target }}/release" splitfire-agent
44 echo "asset=$ARCHIVE.tar.gz" >> "$GITHUB_ENV"
45 fi
46 - name: Upload release asset
47 shell: bash
48 env:
49 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 run: |
51 # Create the release once (first matrix job wins; others no-op).
52 # Tolerate only the already-exists race: a genuinely failed create
53 # makes `gh release view` fail too, so the step still fails loudly.
54 gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes \
55 || gh release view "$GITHUB_REF_NAME" >/dev/null
56 gh release upload "$GITHUB_REF_NAME" "$asset" --clobber
57
58 checksums:
59 name: Publish checksums.txt
60 needs: build
61 runs-on: ubuntu-latest
62 steps:
63 - name: Download all release assets
64 env:
65 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66 run: |
67 mkdir -p artifacts
68 gh release download "$GITHUB_REF_NAME" \
69 --repo "$GITHUB_REPOSITORY" \
70 --pattern "splitfire-agent-*" \
71 --dir artifacts/
72
73 - name: Generate checksums.txt
74 run: |
75 cd artifacts
76 sha256sum splitfire-agent-* > checksums.txt
77 cat checksums.txt
78
79 - name: Upload checksums.txt
80 env:
81 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82 run: |
83 gh release upload "$GITHUB_REF_NAME" \
84 --repo "$GITHUB_REPOSITORY" \
85 artifacts/checksums.txt --clobber