-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 1.91 KB
/
cd.yaml
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
name: CD
on:
push:
branches: master
paths: "**.rs"
workflow_dispatch:
env:
RELEASE_BIN: sneaky
jobs:
build_release:
name: Build release
strategy:
matrix:
include:
- os: ubuntu-latest
targets: [x86_64-unknown-linux-gnu]
- os: macos-latest
targets: [x86_64-apple-darwin, aarch64-apple-darwin]
- os: windows-latest
targets: [x86_64-pc-windows-msvc]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ join(matrix.targets, ',') }}
- uses: Swatinem/rust-cache@v2
- name: Build
shell: bash
run: |
for target in ${{ join(matrix.targets, ' ') }}; do
cargo build --release --target $target
done
- name: Upload Linux binary
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-linux-x86_64
path: ./target/x86_64-unknown-linux-gnu/release/${{ env.RELEASE_BIN }}
if: matrix.os == 'ubuntu-latest'
- name: Upload Windows binary
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-windows-x86_64.exe
path: ./target/x86_64-pc-windows-msvc/release/${{ env.RELEASE_BIN }}.exe
if: matrix.os == 'windows-latest'
- name: Create macOS binary
run: |
lipo -create -output ./${{ env.RELEASE_BIN }}-mac-universal ./target/x86_64-apple-darwin/release/${{ env.RELEASE_BIN }} ./target/aarch64-apple-darwin/release/${{ env.RELEASE_BIN }}
if: matrix.os == 'macos-latest'
- name: Upload macOS binary
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-mac-universal
path: ./${{ env.RELEASE_BIN }}-mac-universal
if: matrix.os == 'macos-latest'