-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (81 loc) · 2.73 KB
/
rust.yml
File metadata and controls
99 lines (81 loc) · 2.73 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
name: Release axkeystore
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.asset }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ---------- Linux ----------
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: axkeystore
asset: axkeystore-linux-x86_64
# ---------- Windows ----------
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: axkeystore.exe
asset: axkeystore-windows-x86_64.exe
# ---------- macOS Apple Silicon ----------
- os: macos-latest
target: aarch64-apple-darwin
binary: axkeystore
asset: axkeystore-macos-aarch64
# ---------- macOS Intel ----------
- os: macos-latest
target: x86_64-apple-darwin
binary: axkeystore
asset: axkeystore-macos-x86_64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Build release
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (Linux & macOS)
if: runner.os != 'Windows'
run: strip target/${{ matrix.target }}/release/${{ matrix.binary }}
- name: Rename binary
run: cp target/${{ matrix.target }}/release/${{ matrix.binary }} target/${{ matrix.target }}/release/${{ matrix.asset }}
- name: Generate SHA256 (non-Windows)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
shasum -a 256 ${{ matrix.asset }} > ${{ matrix.asset }}.sha256
- name: Generate SHA256 (Windows)
if: runner.os == 'Windows'
run: |
cd target/${{ matrix.target }}/release
certutil -hashfile "${{ matrix.asset }}" SHA256 | findstr /v /c:"hash" /c:"CertUtil" > "${{ matrix.asset }}.sha256"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: |
target/${{ matrix.target }}/release/${{ matrix.asset }}
target/${{ matrix.target }}/release/${{ matrix.asset }}.sha256
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/**/*