-
-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (53 loc) · 1.89 KB
/
build.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
name: Build
on:
push:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build project
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install nasm
uses: ilammy/setup-nasm@v1
- uses: Swatinem/rust-cache@v2
- name: Build
run: |
cargo build --release
- name: Get git commit hash (Windows)
if: ${{ contains('Windows', runner.os) }}
id: hash_windows
run: echo "hash=$("${{ github.sha }}".SubString(0, 10))" >> $env:GITHUB_OUTPUT
- name: Get git commit hash
if: ${{ !contains('Windows', runner.os) }}
id: hash
run: echo "hash=${GITHUB_SHA:0:10}" >> $GITHUB_OUTPUT
- name: Rename artifact (Windows)
if: ${{ contains('Windows', runner.os) }}
run: mv target/release/mltd.exe mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe
- name: Rename artifact
if: ${{ !contains('Windows', runner.os) }}
run: |
chmod +x target/release/mltd
mv target/release/mltd mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }}
- name: Publish artifact (Windows)
if: ${{ contains('Windows', runner.os) }}
uses: actions/upload-artifact@v3
with:
name: mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe
path: mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe
- name: Publish artifact
if: ${{ !contains('Windows', runner.os) }}
uses: actions/upload-artifact@v3
with:
name: mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }}
path: mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }}