-
Notifications
You must be signed in to change notification settings - Fork 91
82 lines (70 loc) · 2.92 KB
/
deploy.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build and upload assets
on:
release:
types: [ published ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Build gnu-linux on ubuntu-18.04 and musl on ubuntu latest
os: [ ubuntu-20.04, ubuntu-latest, windows-latest, macos-latest ]
name: Building, ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
id: rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc
- name: Create bin directory
run: mkdir bin
- name: Build on Linux GNU
if: matrix.os == 'ubuntu-20.04'
# We're using musl to make the binaries statically linked and portable
run: |
cargo build --target=x86_64-unknown-linux-gnu --release
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-linux-gnu-amd64"
strip ./target/x86_64-unknown-linux-gnu/release/kaspa-miner
mv ./target/x86_64-unknown-linux-gnu/release/kaspa-miner ./bin/${asset_name}
- name: Build on Linux musl
if: matrix.os == 'ubuntu-latest'
# We're using musl to make the binaries statically linked and portable
run: |
sudo apt-get install -y musl-tools
rustup target add x86_64-unknown-linux-musl
cargo build --target=x86_64-unknown-linux-musl --release
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-linux-musl-amd64"
strip ./target/x86_64-unknown-linux-musl/release/kaspa-miner
mv ./target/x86_64-unknown-linux-musl/release/kaspa-miner ./bin/${asset_name}
- name: Build on Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
cargo build --target=x86_64-pc-windows-msvc --release
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-win64-amd64.exe"
mv ./target/x86_64-pc-windows-msvc/release/kaspa-miner.exe ./bin/${asset_name}
- name: Build on MacOS for x86_64
if: matrix.os == 'macos-latest'
run: |
cargo build --target=x86_64-apple-darwin --release
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-osx-amd64"
mv ./target/x86_64-apple-darwin/release/kaspa-miner ./bin/${asset_name}
- name: Build on MacOS for M1/2
if: matrix.os == 'macos-latest'
run: |
rustup target add aarch64-apple-darwin
cargo build --target=aarch64-apple-darwin --release
asset_name="kaspa-miner-${{ github.event.release.tag_name }}-osx-aarch64"
mv ./target/aarch64-apple-darwin/release/kaspa-miner ./bin/${asset_name}
- name: Upload release asset
uses: softprops/action-gh-release@v1
with:
files: |
bin/*