-
Notifications
You must be signed in to change notification settings - Fork 3
120 lines (100 loc) · 3.8 KB
/
release.yml
File metadata and controls
120 lines (100 loc) · 3.8 KB
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
118
119
120
# Create a prerelease, build and upload executables to the prerelease when pushing a tag.
name: Build Executables
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
publish:
name: Build ${{ matrix.build.target }} on ${{ matrix.build.os }}
runs-on: ${{ matrix.build.os }}
strategy:
matrix:
build:
- os: ubuntu-latest
os_prefix: ubuntu
target: aarch64-unknown-linux-gnu
command: cross
- os: ubuntu-latest
os_prefix: ubuntu
target: x86_64-unknown-linux-gnu
command: cargo
- os: macos-latest
os_prefix: macos
target: x86_64-apple-darwin
command: cargo
- os: macos-14
os_prefix: macos
target: aarch64-apple-darwin
command: cargo
- os: windows-latest
os_prefix: windows
target: x86_64-pc-windows-msvc
command: cargo
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
components: rust-src, clippy
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# The default clang on macOS does not have wasm32 support, install it on our own.
- name: Install LLVM and Clang (macOS)
uses: KyleMayes/install-llvm-action@v2
with:
version: "15.0"
if: ${{ matrix.build.os == 'macos-latest' || matrix.build.os == 'macos-14' }}
- name: Install target
run: |
rustup target add ${{ matrix.build.target }}
- name: Install cross
run: |
cargo install cross --git https://github.com/cross-rs/cross
if: ${{ matrix.build.command == 'cross' }}
- name: Configure cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.build.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build subcoin binary
run: |
${{ matrix.build.command }} build --profile production --bin subcoin --locked --target ${{ matrix.build.target }}
- name: Build snapcake binary
run: |
${{ matrix.build.command }} build --profile production --bin snapcake --locked --target ${{ matrix.build.target }}
- name: Get version without v prefix (Ubuntu/macOS)
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
if: ${{ matrix.build.os != 'windows-latest' }}
- name: Get version without v prefix (Windows)
run: |
$version = "${{ github.ref_name }}".substring(1)
echo "VERSION=$version" >> $env:GITHUB_ENV
if: ${{ matrix.build.os == 'windows-latest' }}
- name: Upload subcoin binary to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.build.target }}/production/subcoin${{ matrix.build.os == 'windows-latest' && '.exe' || '' }}
tag: ${{ github.ref }}
asset_name: subcoin-${{ env.VERSION }}-${{ matrix.build.target }}${{ matrix.build.os == 'windows-latest' && '.exe' || '' }}
prerelease: true
- name: Upload snapcake binary to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.build.target }}/production/snapcake${{ matrix.build.os == 'windows-latest' && '.exe' || '' }}
tag: ${{ github.ref }}
asset_name: snapcake-${{ env.VERSION }}-${{ matrix.build.target }}${{ matrix.build.os == 'windows-latest' && '.exe' || '' }}
prerelease: true