Repository navigation
63 lines (61 loc) · 2.33 KB
/
Copy pathrelease.yml
File metadata and controls
63 lines (61 loc) · 2.33 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: tar.gz
binary: stack-intercept
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: zip
binary: stack-intercept.exe
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Configure MSVC environment
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- uses: Swatinem/rust-cache@v2
- run: cargo build --release
- name: Strip binary (Linux only)
if: runner.os == 'Linux'
run: strip target/release/${{ matrix.binary }}
- name: Create package directory
shell: bash
run: |
mkdir -p dist/stack-intercept
cp target/release/${{ matrix.binary }} dist/stack-intercept/
cp .env.example README.md download_model.sh dist/stack-intercept/
cp -r docs dist/stack-intercept/
- name: Package Linux tarball and checksum
if: runner.os == 'Linux'
run: |
VERSION="${GITHUB_REF_NAME#v}"
tar czf "stack-intercept-v${VERSION}-${{ matrix.target }}.tar.gz" -C dist stack-intercept
sha256sum "stack-intercept-v${VERSION}-${{ matrix.target }}.tar.gz" > "checksums-${{ matrix.target }}.txt"
- name: Package Windows zip and checksum
if: runner.os == 'Windows'
shell: pwsh
run: |
$version = "$env:GITHUB_REF_NAME" -replace '^v'
Compress-Archive -Path dist\stack-intercept -DestinationPath "stack-intercept-v${version}-${{ matrix.target }}.zip"
$hash = (Get-FileHash "stack-intercept-v${version}-${{ matrix.target }}.zip" -Algorithm SHA256).Hash.ToLower()
"$hash stack-intercept-v${version}-${{ matrix.target }}.zip" | Out-File -FilePath "checksums-${{ matrix.target }}.txt"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
stack-intercept-*.${{ matrix.ext }}
checksums-${{ matrix.target }}.txt
generate_release_notes: ${{ matrix.os == 'ubuntu-latest' }}
fail_on_unmatched_files: true