-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (48 loc) · 1.49 KB
/
release.yml
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
name: Release
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cargo Test
run: |
cargo test
# - name: Cargo Clippy
# run: |
# cargo clippy -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used
- name: Cargo Build Binary
run: |
cargo build --release
chmod +x target/release/${{ github.event.repository.name }}
- name: Optimize Binary with UPX
run: |
upx --best --lzma target/release/${{ github.event.repository.name }}
- name: Package Binary
run: |
toolchain=$(rustup toolchain list | awk '{print $1;}')
tar_name="${{ github.event.repository.name }}_${{ github.ref_name }}-$toolchain"
tar -cvzf target/release/$tar_name.tar.gz target/release/${{ github.event.repository.name }}
- name: Release
uses: docker://antonyurchenko/git-release:v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHANGELOG_FILE: CHANGELOG.md
with:
args: |
target/release/*.tar.gz