-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (83 loc) · 2.61 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
79
80
81
82
83
84
85
86
87
88
89
90
91
---
on:
push:
# Uncomment to test against a branch
branches:
- ci
tags:
- 'v*'
jobs:
get_version:
name: Get version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag
id: get_version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version=${GITHUB_REF#refs/tags/v}
else
version=0.0.0-${GITHUB_REF#refs/heads/}
fi
echo "version=${version}" >> "${GITHUB_OUTPUT}"
build_and_upload:
name: Build and upload assets
needs: get_version
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -C strip=symbols
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get Rust target triple
id: get_target
shell: bash
run: |
echo -n 'name=' >> "${GITHUB_OUTPUT}"
rustc -vV | sed -n 's|host: ||p' >> "${GITHUB_OUTPUT}"
- name: Install build dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt install -y libdbus-1-dev
- name: Run clippy checks in release mode
env:
RUST_BACKTRACE: 1
run: |
cargo clippy --workspace --release -- -D warnings
- name: Build in release mode
run: cargo build --release
- name: Build archive
id: build_archive
shell: bash
run: |
base_name=svrbsctl-${{ needs.get_version.outputs.version }}-${{ steps.get_target.outputs.name }}
mkdir "${base_name}"
cp {README.md,LICENSE} "${base_name}/"
if [[ "${{ matrix.os }}" == windows-* ]]; then
cp target/release/svrbsctl.exe "${base_name}/"
7z a "${base_name}.zip" "${base_name}"
echo "name=${base_name}.zip" >> "${GITHUB_OUTPUT}"
else
cp target/release/svrbsctl "${base_name}/"
tar -I zstd -cvf "${base_name}.tar.zst" "${base_name}"
echo "name=${base_name}.tar.zst" >> "${GITHUB_OUTPUT}"
fi
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ needs.get_version.outputs.version }}
name: Version ${{ needs.get_version.outputs.version }}
draft: true
prerelease: false
files: ${{ steps.build_archive.outputs.name }}