-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (61 loc) · 2.57 KB
/
release.yml
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
name: Release
on:
# TODO re-enable once project is set up properly if you have bins to publish, otherwise remove the workflow
#release:
# types: [created]
workflow_dispatch:
jobs:
build-release-files:
name: Build release files for ${{ matrix.arch }}-${{ matrix.platform }} with Rust ${{ matrix.toolchain }}
if: github.repository_owner == 'clechasseur' # Don't build on forks
strategy:
matrix:
toolchain: [ stable ]
arch: [ aarch64, x86_64 ]
platform: [ unknown-linux-gnu, unknown-linux-musl, unknown-freebsd, apple-darwin, pc-windows-msvc ]
include:
- os: ubuntu-latest
- platform: apple-darwin
os: macos-latest
- platform: pc-windows-msvc
os: windows-latest
- crt-static: false
- link-self-contained: false
- platform: pc-windows-msvc
crt-static: true
- platform: unknown-linux-musl
crt-static: true
link-self-contained: true
exclude:
- arch: aarch64
platform: unknown-freebsd
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
toolchain: ${{ matrix.toolchain }}
cache: false
- name: Setup cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@0d2c6fcce937ba2ba77abf40e06449b74d60fa04 # v1.28.3
with:
target: ${{ matrix.arch }}-${{ matrix.platform }}
- name: Set flag to link crt-static
run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> ${GITHUB_ENV}
if: ${{ matrix.crt-static }}
- name: Set flag to link self-contained
run: echo "RUSTFLAGS=${RUSTFLAGS} -C link-self-contained=yes" >> ${GITHUB_ENV}
if: ${{ matrix.link-self-contained }}
- name: Build binaries and upload to GitHub release
uses: taiki-e/upload-rust-binary-action@e7953b6078194a4ae5f5619632e3715db6275561 # v1.24.0
with:
bin: YOUR-BINS-HERE # TODO replace this with a comma-separated list of bins to publish
token: ${{ secrets.GITHUB_TOKEN }}
archive: $bin-$target-$tag # TODO if you have mulitiple bins, replace $bin here
target: ${{ matrix.arch }}-${{ matrix.platform }}
include: LICENSE,README.md
leading-dir: true