-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (96 loc) · 2.94 KB
/
release.yml
File metadata and controls
111 lines (96 loc) · 2.94 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
on:
push:
branches:
- "master"
tags:
- "v*"
env:
CARGO_INCREMENTAL: 0
jobs:
release:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
file: base32768
output: base32768-linux.zip
- target: x86_64-pc-windows-gnu
file: base32768.exe
output: base32768-windows.zip
name: release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.1
- if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: |
sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Get Rust toolchain
id: toolchain
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- name: install clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
toolchain: ${{ steps.toolchain.outputs.toolchain }}
targets: x86_64-pc-windows-gnu
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
target: x86_64-pc-windows-gnu
- name: cache dependencies
uses: Swatinem/rust-cache@v2.8.2
- name: clippy check
uses: sksat/action-clippy@v1.1.1
with:
reporter: github-check
- name: install cargo-license
run: cargo install cargo-license
- name: unit test
run: |
cargo test --no-run --locked
cargo test
- name: build
env:
TARGET: ${{ matrix.target }}
run:
cargo build --release --target $TARGET
- env:
TARGET: ${{ matrix.target }}
FILE: ${{ matrix.file }}
OUTPUT: ${{ matrix.output }}
run: |
mkdir base32768
cargo license \
--authors \
--do-not-bundle \
--avoid-dev-deps \
--avoid-build-deps \
--filter-platform $TARGET \
> base32768/CREDITS
VERSION_NAME=${GITHUB_REF##*/}
if [[ $VERSION_NAME == "master" ]]; then
VERSION_NAME=$(git rev-parse --short HEAD)
elif [[ ${VERSION_NAME:0:1} == "v" ]]; then
VERSION_NAME=${VERSION_NAME:1}
fi
echo "$VERSION_NAME" > base32768/VERSION.txt
cp LICENSE README.md base32768/
cp target/$TARGET/release/$FILE base32768/
zip -r $OUTPUT base32768
- name: pre-release
uses: softprops/action-gh-release@v2.5.0
if: "! startsWith(github.ref, 'refs/tags/')"
with:
tag_name: nightly-${{ github.sha }}
prerelease: true
fail_on_unmatched_files: true
files: |
${{ matrix.output }}
- name: tagged-release
uses: softprops/action-gh-release@v2.5.0
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
${{ matrix.output }}