-
Notifications
You must be signed in to change notification settings - Fork 2
379 lines (322 loc) · 12.7 KB
/
Copy pathrelease.yml
File metadata and controls
379 lines (322 loc) · 12.7 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
release-debian:
name: Build Debian release artifact (${{ matrix.arch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
platform: linux/amd64
- arch: armhf
platform: linux/arm/v7
- arch: arm64
platform: linux/arm64
steps:
- name: Remove old release artifacts
run: rm -f ../kel-agent_*
- name: Checkout code
uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Debian package in Debian stable container
run: |
docker run --rm --platform "${{ matrix.platform }}" \
-v "${{ github.workspace }}:${{ github.workspace }}" \
-w "${{ github.workspace }}" \
-e SCHROOT_SESSION_ID=debian-docker \
debian:stable \
bash -c '
set -euxo pipefail
export DEBIAN_FRONTEND=noninteractive
apt-get update
# golang-any provides the Go compiler. All Go source deps come
# from go mod vendor inside deb-package-ci, so no golang-*-dev
# packages from the Debian archive are needed here.
apt-get install -y --no-install-recommends \
autorevision \
build-essential \
ca-certificates \
debhelper \
dh-golang \
dpkg-dev \
fakeroot \
git \
golang-any \
libhamlib-dev \
make \
pkg-config \
wget
# The workspace is bind-mounted from the host runner; git
# considers it "dubious" because the container runs as root.
# Mark it safe so autorevision can read git metadata.
git config --global --add safe.directory "${{ github.workspace }}"
make deb-package-ci
mkdir -p "${{ github.workspace }}/dist"
cp ../kel-agent_*_${{ matrix.arch }}.deb "${{ github.workspace }}/dist/"
'
- name: Verify shared library dependencies
run: |
echo "==> Checking .deb contents"
dpkg-deb -c dist/kel-agent_*_${{ matrix.arch }}.deb
echo "==> Checking binary dependencies"
dpkg-deb -x dist/kel-agent_*_${{ matrix.arch }}.deb /tmp/deb-extract
ldd /tmp/deb-extract/usr/bin/kel-agent || true
- name: Upload Debian artifact
uses: actions/upload-artifact@v7
with:
name: deb-${{ matrix.arch }}
path: dist/kel-agent_*_${{ matrix.arch }}.deb
if-no-files-found: error
release-flatpak:
name: Build the Flatpak release artifact
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-20.08
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Mark workspace as git-safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build Flatpak
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6
with:
bundle: kel-agent.flatpak
manifest-path: flatpak/radio.k0swe.Kel_Agent.yml
branch: main
cache-key: flatpak-builder-${{ github.sha }}
- name: Upload Flatpak artifact
uses: actions/upload-artifact@v7
with:
name: flatpak
path: kel-agent.flatpak
if-no-files-found: error
release-macos:
name: Build the MacOS release artifact
runs-on: macos-latest
steps:
- name: Create keychain with signing certificates
run: |
set -euo pipefail
keychain=~/Library/Keychains/k0swe.keychain-db
# Create a fresh keychain (delete first in case of reuse)
security delete-keychain k0swe.keychain 2>/dev/null || true
security create-keychain -p "" k0swe.keychain
security set-keychain-settings -lut 21600 "$keychain"
security unlock-keychain -p "" "$keychain"
# Decode P12 and import all identities, granting access to both
# codesign (for app binaries) and productsign (for installer pkgs)
echo "${{ secrets.CERTIFICATES_P12 }}" | base64 -d > /tmp/certs.p12
security import /tmp/certs.p12 -k "$keychain" \
-P "${{ secrets.CERTIFICATES_P12_PASSWORD }}" \
-T /usr/bin/codesign -T /usr/bin/productsign
rm -f /tmp/certs.p12
# Allow tools to use the keys without an interactive password prompt
security set-key-partition-list -S apple-tool:,apple: -s -k "" "$keychain"
# Add to the user keychain search list
security list-keychains -d user -s "$keychain" ~/Library/Keychains/login.keychain-db
- name: Checkout code
uses: actions/checkout@v7
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: 1.26.x
- name: Build Hamlib
run: |
brew install automake libtool
make hamlib
- name: Test
env:
SKIP_INTEGRATION_TESTS: "1"
run: make test
- name: Set signing keychain as default
run: security default-keychain -d user -s ~/Library/Keychains/k0swe.keychain-db
- name: Resolve signing identities from imported certificate
run: |
set -euo pipefail
keychain=~/Library/Keychains/k0swe.keychain-db
app_identity=$(security find-identity -v -p codesigning "$keychain" | sed -n 's/.*"\(Developer ID Application:.*\)"/\1/p' | head -n1)
installer_identity=$(security find-identity -v -p basic "$keychain" | sed -n 's/.*"\(Developer ID Installer:.*\)"/\1/p' | head -n1)
if [ -z "$app_identity" ] || [ -z "$installer_identity" ]; then
echo "::error::Unable to resolve Developer ID signing identities from imported certificate."
echo "==> Available codesigning identities:"
security find-identity -v -p codesigning "$keychain" || true
echo "==> Available basic identities:"
security find-identity -v -p basic "$keychain" || true
exit 1
fi
echo "Resolved Developer ID Application identity."
echo "Resolved Developer ID Installer identity."
echo "MACOS_APP_SIGN_IDENTITY=$app_identity" >> "$GITHUB_ENV"
echo "MACOS_INSTALL_SIGN_IDENTITY=$installer_identity" >> "$GITHUB_ENV"
- name: Build Mac package
run: make mac-package
- name: Verify shared library dependencies
run: otool -L out/macos-pkg/root/usr/local/bin/kel-agent
- name: Notarize Mac package
run: |
output=$(xcrun notarytool submit kel-agent_mac.pkg \
--apple-id "${{ secrets.APPLE_ID }}" \
--password "${{ secrets.APPLE_APP_PASSWORD }}" \
--team-id "${{ secrets.APPLE_TEAM_ID }}" \
--output-format json \
--wait)
echo "$output"
json_response=$(echo "$output" | tail -1)
submission_id=$(echo "$json_response" | jq -r '.id // empty')
status=$(echo "$json_response" | jq -r '.status // empty')
if [ "$status" != "Accepted" ]; then
echo "::error::Notarization status is '$status' (expected 'Accepted')"
if [ -n "$submission_id" ]; then
echo "==> Fetching Apple notarization log for submission $submission_id"
xcrun notarytool log "$submission_id" \
--apple-id "${{ secrets.APPLE_ID }}" \
--password "${{ secrets.APPLE_APP_PASSWORD }}" \
--team-id "${{ secrets.APPLE_TEAM_ID }}" || true
fi
exit 1
fi
- name: Staple notarization ticket
run: xcrun stapler staple kel-agent_mac.pkg
- name: Upload macOS artifact
uses: actions/upload-artifact@v7
with:
name: macos
path: kel-agent_mac.pkg
if-no-files-found: error
release-windows:
name: Build the Windows release artifact
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Install Go
uses: actions/setup-go@v6
with:
# https://packages.debian.org/stable/golang
go-version: 1.26.x
- name: Install MSYS2 with MinGW64 pkg-config
id: msys2
# Explicitly install MSYS2 and mingw-w64-x86_64-pkgconf instead of relying on
# whatever MSYS2 subsystems the runner image happens to pre-install. Runner images
# have changed which subsystems are present, causing pkg-config probing to fail.
# PKG_CONFIG is set to the full .exe path so CGo bypasses Strawberry Perl's
# pkg-config.bat shim that appears earlier on the default PATH and breaks CGo.
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: mingw-w64-x86_64-pkgconf
- name: Export PKG_CONFIG path
run: |
$msys2Location = "${{ steps.msys2.outputs.msys2-location }}"
if (-not $msys2Location) {
Write-Error "msys2/setup-msys2 did not expose msys2-location output"
exit 1
}
Write-Host "MSYS2 location: $msys2Location"
# pkgconf >= 1~2.0 ships as pkgconf.exe; older releases ship pkg-config.exe.
# Search all common MSYS2 environments and fallback locations because runner
# images have changed default install paths and available subsystems.
$candidateBins = @(
"$msys2Location\mingw64\bin"
"$msys2Location\ucrt64\bin"
"$msys2Location\clang64\bin"
"C:\msys64\mingw64\bin"
"D:\a\_temp\msys64\mingw64\bin"
) | Where-Object { Test-Path $_ } | Select-Object -Unique
$pkgConfigExe = $null
foreach ($bin in $candidateBins) {
foreach ($exe in @("pkg-config.exe", "pkgconf.exe")) {
$candidate = Join-Path $bin $exe
if (Test-Path $candidate) {
$pkgConfigExe = $candidate
break
}
}
if ($pkgConfigExe) { break }
}
if (-not $pkgConfigExe) {
Write-Error "Neither pkg-config.exe nor pkgconf.exe found in candidate bins: $($candidateBins -join ', ')"
exit 1
}
$pkgConfigBin = Split-Path $pkgConfigExe -Parent
Write-Host "Using pkg-config from: $pkgConfigExe"
Add-Content $env:GITHUB_PATH $pkgConfigBin
Add-Content $env:GITHUB_ENV "PKG_CONFIG=$pkgConfigExe"
- name: Verify pkg-config
run: |
& $env:PKG_CONFIG --version
- name: Build Hamlib
shell: bash
run: make hamlib
- name: Test
shell: bash
run: make test
- name: Install WiX v4
run: dotnet tool install --global wix --version 4.*
- name: Build Windows package
run: |
$env:PATH += ";$env:USERPROFILE\.dotnet\tools"
make win-package
- name: Upload Windows artifact
uses: actions/upload-artifact@v7
with:
name: windows
path: win/kel-agent.msi
if-no-files-found: error
publish:
name: Publish release artifacts
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- release-debian
- release-flatpak
- release-macos
- release-windows
steps:
- name: Download Debian artifacts
uses: actions/download-artifact@v8
with:
path: release-artifacts
pattern: deb-*
merge-multiple: true
- name: Download Flatpak artifact
uses: actions/download-artifact@v8
with:
name: flatpak
path: release-artifacts
- name: Download macOS artifact
uses: actions/download-artifact@v8
with:
name: macos
path: release-artifacts
- name: Download Windows artifact
uses: actions/download-artifact@v8
with:
name: windows
path: release-artifacts
- name: List release artifacts
run: ls -lah release-artifacts
- name: Publish GitHub release assets
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
release-artifacts/*.deb
release-artifacts/kel-agent.flatpak
release-artifacts/kel-agent_mac.pkg
release-artifacts/kel-agent.msi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}