-
Notifications
You must be signed in to change notification settings - Fork 1
165 lines (135 loc) · 4.83 KB
/
Copy pathrelease.yml
File metadata and controls
165 lines (135 loc) · 4.83 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
env:
BINARY_NAME: qd2
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.asset_suffix }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
target: x86_64-unknown-linux-gnu
asset_suffix: linux-x86_64
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
asset_suffix: linux-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-4-dev libpixman-1-dev libusb-1.0-0-dev pkg-config dpkg-dev desktop-file-utils meson ninja-build
- name: Install usbredir for qemu-display
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
git clone --branch usbredir-0.13.0 --depth 1 https://gitlab.freedesktop.org/spice/usbredir.git /tmp/usbredir
meson setup /tmp/usbredir/build /tmp/usbredir --prefix=/usr/local
meson compile -C /tmp/usbredir/build
sudo meson install -C /tmp/usbredir/build
sudo ldconfig
multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
{
echo "PKG_CONFIG_PATH=/usr/local/lib/${multiarch}/pkgconfig:/usr/local/lib/pkgconfig"
echo "LD_LIBRARY_PATH=/usr/local/lib/${multiarch}:/usr/local/lib"
} >> "$GITHUB_ENV"
pkg-config --modversion libusbredirhost
pkg-config --modversion libusbredirparser-0.5
- name: Validate desktop launcher
if: runner.os == 'Linux'
run: desktop-file-validate packaging/linux/qd2.desktop
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo build outputs
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install Linux packaging tools
if: runner.os == 'Linux'
run: cargo install --locked cargo-deb cargo-generate-rpm
- name: Build release binary
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package release artifact
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME}"
package_dir="${BINARY_NAME}-${version}-${{ matrix.asset_suffix }}"
mkdir -p "dist/${package_dir}"
cp "target/${{ matrix.target }}/release/${BINARY_NAME}" "dist/${package_dir}/"
cp README.md "dist/${package_dir}/"
tar -C dist -czf "dist/${package_dir}.tar.gz" "${package_dir}"
- name: Package Linux installers
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#v}"
cargo deb --no-build --target "${{ matrix.target }}" --output "dist/${BINARY_NAME}_${version}_${{ matrix.asset_suffix }}.deb"
cargo generate-rpm --target "${{ matrix.target }}" -o "dist/${BINARY_NAME}-${version}-${{ matrix.asset_suffix }}.rpm"
- name: Upload packaged artifact
uses: actions/upload-artifact@v6
with:
name: release-${{ matrix.target }}
path: |
dist/*.tar.gz
dist/*.deb
dist/*.rpm
release:
name: Publish release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Download packaged artifacts
uses: actions/download-artifact@v8
with:
pattern: release-*
path: dist
merge-multiple: true
- name: Generate checksums
run: |
find dist -maxdepth 1 -type f ! -name 'SHA256SUMS.txt' -print0 \
| sort -z \
| xargs -0 sha256sum > dist/SHA256SUMS.txt
- name: Create GitHub release shell
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release create "${GITHUB_REF_NAME}" \
--verify-tag \
--title "${GITHUB_REF_NAME}" \
--notes ""
fi
- name: Generate changelog with changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx changelogithub
- name: Upload release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "${GITHUB_REF_NAME}" dist/* --clobber