-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (97 loc) · 3.35 KB
/
release.yml
File metadata and controls
118 lines (97 loc) · 3.35 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
115
116
117
118
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
runner: macos-latest
asset_name: dstimer-macos-x86_64
- target: aarch64-apple-darwin
runner: macos-latest
asset_name: dstimer-macos-aarch64
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
asset_name: dstimer-linux-x86_64
use_upx: true
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
asset_name: dstimer-linux-aarch64
use_cross: true
use_upx: true
- target: x86_64-pc-windows-msvc
runner: windows-latest
asset_name: dstimer.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install ALSA dev libraries (Linux x86_64)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev pkg-config
- name: Install cross (Linux aarch64)
if: matrix.use_cross == true
uses: taiki-e/install-action@cross
- name: Build (cross)
if: matrix.use_cross == true
run: cross build --release --target ${{ matrix.target }}
- name: Build (cargo)
if: matrix.use_cross != true
run: cargo build --release --target ${{ matrix.target }}
- name: Compress binary with UPX (Linux)
if: matrix.use_upx == true && matrix.runner == 'ubuntu-latest'
run: |
sudo apt-get install -y upx-ucl
upx --best --lzma target/${{ matrix.target }}/release/dstimer
- name: Compress binary with UPX (Windows)
if: matrix.use_upx == true && matrix.runner == 'windows-latest'
run: |
choco install upx -y
upx --best --lzma target/${{ matrix.target }}/release/dstimer.exe
- name: Rename binary (Unix)
if: matrix.runner != 'windows-latest'
run: cp target/${{ matrix.target }}/release/dstimer ${{ matrix.asset_name }}
- name: Rename binary (Windows)
if: matrix.runner == 'windows-latest'
run: cp target/${{ matrix.target }}/release/dstimer.exe ${{ matrix.asset_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create release and upload assets
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
# publish-winget:
# name: Publish to WinGet
# needs: release
# runs-on: windows-latest
# steps:
# - name: Submit to WinGet
# uses: vedantmgoyal9/winget-releaser@v2
# with:
# identifier: madLinux.dstimer
# installers-regex: 'dstimer\.exe$'
# token: ${{ secrets.WINGET_TOKEN }}