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
name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
id-token: write
jobs:
build-release:
name: Build Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: gvc
asset_name: gvc-linux-x86_64
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact_name: gvc
asset_name: gvc-linux-aarch64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: gvc
asset_name: gvc-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: gvc
asset_name: gvc-macos-aarch64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: gvc.exe
asset_name: gvc-windows-x86_64.exe
steps:
- uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
shell: bash
- name: Strip binary (Linux/macOS)
if: matrix.os != 'windows-latest'
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Rename binary
run: |
mkdir -p release
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} release/${{ matrix.asset_name }}
shell: bash
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: release/${{ matrix.asset_name }}
if-no-files-found: error
create-release:
name: Create GitHub Release
needs:
- build-release
- publish-crate
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Gather release assets
run: |
mkdir -p release
find artifacts -type f -exec cp {} release/ \;
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
files: release/*
draft: false
prerelease: false
generate_release_notes: true
publish-crate:
name: Publish to crates.io
needs: build-release
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Authenticate with crates.io
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}