-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (73 loc) · 2.43 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
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
name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
release:
name: "Release"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: rmrfrs
asset_name: rmrfrs-linux-gnu-amd64
- os: windows-latest
artifact_name: rmrfrs.exe
asset_name: rmrfrs-windows-amd64.exe
- os: macos-latest
artifact_name: rmrfrs
asset_name: rmrfrs-darwin-amd64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build release
run: cargo build --release --locked
- name: Set prerelease flag (non-Windows)
if: runner.os != 'Windows'
run: |
if [ $(echo ${{ github.ref }} | grep "rc") ]; then
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "PRERELEASE=true"
else
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "PRERELEASE=false"
fi
echo $PRERELEASE
VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\///g')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION"
- name: Set prerelease flag (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$full = "${{ github.ref }}"
if ( $full -like '*rc*' ) {
echo "PRERELEASE=true" >> $env:GITHUB_ENV
echo "PRERELEASE=true"
} else {
echo "PRERELEASE=false" >> $env:GITHUB_ENV
echo "PRERELEASE=false"
}
$trimmed = $full -replace 'refs/tags/',''
echo "VERSION=$trimmed" >> $env:GITHUB_ENV
echo "VERSION=$trimmed"
- name: Upload release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}
prerelease: ${{ env.PRERELEASE }}
release_name: "rmrfrs ${{ env.VERSION }}"
body: "Please refer to **[CHANGELOG.md](https://github.com/trinhminhtriet/rmrfrs/blob/master/CHANGELOG.md)** for information on this release."