forked from grouzen/framework-tool-tui
-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (98 loc) · 3.24 KB
/
ci-release.yaml
File metadata and controls
114 lines (98 loc) · 3.24 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
112
113
114
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
use-cross: false
target: x86_64-unknown-linux-gnu
- build: freebsd
os: ubuntu-latest
use-cross: false
target: x86_64-unknown-freebsd
- build: windows
os: windows-2025
use-cross: false
target: x86_64-pc-windows-msvc
# TODO: Remove rustflags workaround when framework_lib updates to built v0.8+ with gix feature.
# Issue: libgit2-sys v0.14.x doesn't link advapi32.lib on Windows.
# See: https://github.com/rust-lang/git2-rs/issues/1016
rustflags: "-C link-arg=advapi32.lib"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install libudev-dev (Linux)
if: matrix.build == 'linux'
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: Build FreeBSD
if: matrix.build == 'freebsd'
uses: vmactions/freebsd-vm@v1
with:
release: "15.0"
arch: x86_64
usesh: true
mem: 8192
sync: rsync
prepare: |
pkg install -y rust hidapi pkgconf
run: |
cargo build --release --locked
cp target/release/framework-tool-tui framework-tool-tui-freebsd
- name: Install cross
if: matrix.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
- uses: moonrepo/setup-rust@v1
if: matrix.build != 'freebsd'
with:
targets: ${{ matrix.target }}
- name: Build (without cross)
if: matrix.build != 'freebsd' && !matrix.use-cross
run: cargo build --release --locked
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Build (cross)
if: matrix.use-cross
run: cross build --release --locked --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
binary_name="framework-tool-tui"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.build }}" = "windows" ]; then
mv "target/release/$binary_name.exe" "$dirname"
elif [ "${{ matrix.build }}" = "freebsd" ]; then
mv "$binary_name-freebsd" "$dirname/$binary_name"
else
mv "target/release/$binary_name" "$dirname"
fi
if [ "${{ matrix.build }}" = "windows" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.ASSET }}