-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.16 KB
/
rust.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
69
70
71
72
73
74
75
76
77
name: Build and Release
on:
push:
branches: [ main ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build
run: |
if [[ runner.os == 'Linux' ]]; then
cargo build --release
elif [[ runner.os == 'macos' ]]; then
cargo build --release --target x86_64-apple-darwin
elif [[ runner.os == 'windows' ]]; then
cargo build --release --target x86_64-pc-windows-gnu
fi
- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-bin
path: target/${{ matrix.os }}-x86_64/release
release:
needs: build
runs-on: ubuntu-latest # Can be any OS
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
run: |
for os in ubuntu-latest macos-latest windows-latest; do
curl -LJO "https://github.com/${{ github.repository }}/actions/artifacts/${{ github.run_id }}/downloads/${os}-bin.zip"
done
- name: Create Release
uses: nlopes/release-action@v4
with:
tag_name: ${{ github.ref }} # Use pushed tag name
release_name: "Release - ${{ github.sha }} (built on ${{ format('{:%Y-%m-%d}', github.event.time) }})"
body: |
binaries included:
- ubuntu-latest
- macos-latest
- windows-latest
- name: Extract Artifacts
run: |
for file in *.zip; do unzip "$file"; done
- name: Upload Linux Binary
uses: actions/upload-artifact@v3
with:
name: linux-bin
path: ${{ runner.workspace }}/target/linux-x86_64/release
- name: Upload macOS Binary
uses: actions/upload-artifact@v3
with:
name: macos-bin
path: ${{ runner.workspace }}/target/macos-x86_64/release
- name: Upload Windows Binary
uses: actions/upload-artifact@v3
with:
name: windows-bin
path: ${{ runner.workspace }}/target/windows-x86_64/release