1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+ workflow_dispatch :
8+
9+ jobs :
10+ build :
11+ name : Build and Release
12+ runs-on : ${{ matrix.os }}
13+ strategy :
14+ matrix :
15+ include :
16+ - os : ubuntu-latest
17+ target : x86_64-unknown-linux-gnu
18+ artifact_name : llm-pricing
19+ asset_name : llm-pricing-linux-x86_64
20+ - os : ubuntu-latest
21+ target : x86_64-unknown-linux-musl
22+ artifact_name : llm-pricing
23+ asset_name : llm-pricing-linux-x86_64-musl
24+ - os : macos-latest
25+ target : x86_64-apple-darwin
26+ artifact_name : llm-pricing
27+ asset_name : llm-pricing-macos-x86_64
28+ - os : macos-latest
29+ target : aarch64-apple-darwin
30+ artifact_name : llm-pricing
31+ asset_name : llm-pricing-macos-aarch64
32+ - os : windows-latest
33+ target : x86_64-pc-windows-msvc
34+ artifact_name : llm-pricing.exe
35+ asset_name : llm-pricing-windows-x86_64.exe
36+
37+ steps :
38+ - uses : actions/checkout@v4
39+
40+ - name : Install Rust
41+ uses : dtolnay/rust-toolchain@stable
42+ with :
43+ targets : ${{ matrix.target }}
44+
45+ - name : Install musl tools
46+ if : matrix.target == 'x86_64-unknown-linux-musl'
47+ run : sudo apt-get install -y musl-tools
48+
49+ - name : Build
50+ run : cargo build --release --target ${{ matrix.target }}
51+
52+ - name : Strip binary (Linux and macOS)
53+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
54+ run : strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
55+
56+ - name : Upload binaries to release
57+ uses : softprops/action-gh-release@v2
58+ if : startsWith(github.ref, 'refs/tags/')
59+ with :
60+ files : |
61+ target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
62+ name : ${{ matrix.asset_name }}
63+ env :
64+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65+
66+ create-release :
67+ name : Create Release
68+ runs-on : ubuntu-latest
69+ needs : build
70+ if : startsWith(github.ref, 'refs/tags/')
71+
72+ steps :
73+ - uses : actions/checkout@v4
74+
75+ - name : Create Release
76+ uses : softprops/action-gh-release@v2
77+ with :
78+ draft : false
79+ prerelease : false
80+ generate_release_notes : true
81+ env :
82+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments