Repository navigation
387 lines (338 loc) · 17.6 KB
/
Copy pathrelease.yml
File metadata and controls
387 lines (338 loc) · 17.6 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
380
381
382
383
384
385
386
387
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Optional staging label when triggered manually"
required: false
default: "staging"
attach_linux_to_release:
description: "Optional existing release tag (e.g. v1.11.0) to upload Linux assets to"
required: false
default: ""
linux_only:
description: "Skip Windows build when manually dispatching Linux release assets"
type: boolean
required: false
default: false
permissions:
contents: write
id-token: write
attestations: write
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
SMARTMONTOOLS_TAG: "RELEASE_7_5"
SMARTMONTOOLS_SETUP_URL: "https://github.com/smartmontools/smartmontools/releases/download/RELEASE_7_5/smartmontools-7.5.win32-setup.exe"
SMARTMONTOOLS_SRC_URL: "https://github.com/smartmontools/smartmontools/archive/refs/tags/RELEASE_7_5.tar.gz"
SMARTCTL_X64_SHA256: "b5db94e5082c042be44994b7a4fa8f7b5c8e713b2ab1c9a560d8f7a7995ea27d"
jobs:
build-release:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.linux_only != true }}
name: Build Windows NSIS Release & Attest Provenance
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine release channel (Production vs Staging RC)
id: channel
shell: pwsh
run: |
$isTag = "${{ github.ref }}".StartsWith("refs/tags/v")
$refName = "${{ github.ref_name }}"
$isPrerelease = $isTag -and ($refName -match '-(rc|beta|alpha)\b')
"is_tag=$($isTag.ToString().ToLowerInvariant())" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
"prerelease=$($isPrerelease.ToString().ToLowerInvariant())" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- name: Setup Rust stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
- name: Install npm dependencies
run: npm ci
- name: Verify frontend tests, i18n guard and build
run: |
npm run check:i18n
npm test
npm run build
- name: Fetch smartmontools 7.5 binaries and GPL source archive
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
New-Item -ItemType Directory -Force -Path "release-assets", "tools\smartmontools\bin", "tools\smartmontools\doc", "_smt_extract\unpacked" | Out-Null
$setupPath = "_smt_extract\smartmontools-7.5.win32-setup.exe"
$srcTarPath = "release-assets\smartmontools-7.5-RELEASE_7_5-source.tar.gz"
Invoke-WebRequest -Uri $env:SMARTMONTOOLS_SETUP_URL -OutFile $setupPath -UseBasicParsing
Invoke-WebRequest -Uri $env:SMARTMONTOOLS_SRC_URL -OutFile $srcTarPath -UseBasicParsing
# Prefer direct 7z extraction (fast and avoids UAC prompts on CI runners); fallback to silent NSIS extract
$extractDir = (Resolve-Path "_smt_extract\unpacked").ProviderPath
& 7z x $setupPath "-o$extractDir" -y | Out-Null
$smartctl = Get-ChildItem -Path $extractDir -Recurse -Filter "smartctl.exe" -ErrorAction SilentlyContinue | Where-Object {
(Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant() -eq $env:SMARTCTL_X64_SHA256
} | Select-Object -First 1
if (-not $smartctl) {
$proc = Start-Process -FilePath $setupPath -ArgumentList "/S", "/D=$extractDir" -Wait -PassThru
if ($proc.ExitCode -ne 0) {
throw "Both 7z and silent NSIS extraction failed for smartmontools installer (exit $($proc.ExitCode))"
}
$smartctl = Get-ChildItem -Path $extractDir -Recurse -Filter "smartctl.exe" | Where-Object {
(Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant() -eq $env:SMARTCTL_X64_SHA256
} | Select-Object -First 1
}
if (-not $smartctl) {
throw "Could not verify x64 smartctl.exe matching expected SHA-256 $env:SMARTCTL_X64_SHA256"
}
$binDir = $smartctl.Directory.FullName
Copy-Item -Path $smartctl.FullName -Destination "tools\smartmontools\bin\smartctl.exe" -Force
if (Test-Path "$binDir\drivedb.h") {
Copy-Item -Path "$binDir\drivedb.h" -Destination "tools\smartmontools\bin\drivedb.h" -Force
} else {
$drivedb = Get-ChildItem -Path $extractDir -Recurse -Filter "drivedb.h" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($drivedb) {
Copy-Item -Path $drivedb.FullName -Destination "tools\smartmontools\bin\drivedb.h" -Force
}
}
$rootDoc = Get-ChildItem -Path $extractDir -Recurse -Filter "COPYING.txt" | Select-Object -First 1
if ($rootDoc) {
Copy-Item -Path $rootDoc.FullName -Destination "tools\smartmontools\doc\COPYING.txt" -Force
$chksum = Join-Path $rootDoc.Directory.FullName "checksums64.txt"
if (Test-Path $chksum) {
Copy-Item -Path $chksum -Destination "tools\smartmontools\doc\checksums64.txt" -Force
}
}
if (-not (Test-Path "tools\smartmontools\doc\COPYING.txt")) {
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/smartmontools/smartmontools/RELEASE_7_5/COPYING" -OutFile "tools\smartmontools\doc\COPYING.txt" -UseBasicParsing
}
- name: Verify Rust formatting, Clippy, and test suites
run: |
cargo fmt --manifest-path src-tauri/Cargo.toml -- --check
cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings
cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --no-fail-fast
cargo test --manifest-path src-tauri/Cargo.toml --no-fail-fast
- name: Run Playwright UI smoke and NTFS VHDX integration verification
shell: pwsh
run: |
cargo run --manifest-path src-tauri/Cargo.toml --no-default-features --example export_fixture -- results/rust-fixture.json
node tools/smoke_tauri.mjs results/smoke-release
pwsh -NoProfile -File tools/vhdx_integration_test.ps1
- name: Build Tauri NSIS installer
env:
SSD_SENTINEL_UPDATE_REPO: ${{ github.repository }}
run: npm run tauri -- build --bundles nsis
- name: Package Windows x64 Portable ZIP
shell: pwsh
run: pwsh -NoProfile -File tools/package_portable.ps1 -OutDir release-assets
- name: Stage release artifacts and generate SHA256SUMS.txt
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$nsisDir = "src-tauri\target\release\bundle\nsis"
Get-ChildItem -Path $nsisDir -Filter "*-setup.exe" | ForEach-Object {
$cleanName = $_.Name -replace ' ', '-'
Copy-Item -Path $_.FullName -Destination "release-assets\$cleanName" -Force
}
$lines = Get-ChildItem -Path "release-assets" -File | Sort-Object Name | ForEach-Object {
$h = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant()
"$h $($_.Name)"
}
[System.IO.File]::WriteAllLines(
(Join-Path (Resolve-Path "release-assets").ProviderPath "SHA256SUMS.txt"),
[string[]]$lines,
[System.Text.UTF8Encoding]::new($false)
)
- name: Verify Windows binary identity and bundled smartctl
shell: pwsh
run: |
./tools/verify_windows_release.ps1 -AssetDirectory release-assets -SmartctlSha256 $env:SMARTCTL_X64_SHA256
- name: Upload staging artifact (manual workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: ssd-sentinel-staging-${{ inputs.tag }}
path: |
release-assets/*-setup.exe
release-assets/*-portable.zip
release-assets/SHA256SUMS.txt
- name: Generate SLSA / GitHub Build Provenance Attestation
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/attest-build-provenance@v2
with:
subject-path: |
release-assets/*-setup.exe
release-assets/*-portable.zip
release-assets/SHA256SUMS.txt
- name: Publish GitHub Release (Production or RC Pre-Release)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ steps.channel.outputs.prerelease == 'true' }}
generate_release_notes: true
body: |
[Code signing policy](https://github.com/${{ github.repository }}/blob/${{ github.event.repository.default_branch }}/CODE_SIGNING.md) · [Privacy Policy](https://yuefdev.github.io/ssd-sentinel/privacy/)
files: |
release-assets/*-setup.exe
release-assets/*-portable.zip
release-assets/smartmontools-7.5-RELEASE_7_5-source.tar.gz
release-assets/SHA256SUMS.txt
build-linux-release:
name: Build Linux Packages (.deb, .rpm, AppImage, tar.gz) & Attest Provenance
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine release channel (Production vs Staging RC vs Existing Tag Attach)
id: channel
run: |
is_tag="false"
prerelease="false"
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
is_tag="true"
if [[ "${{ github.ref_name }}" =~ -(rc|beta|alpha)([.-]|$) ]]; then
prerelease="true"
fi
fi
echo "is_tag=${is_tag}" >> "$GITHUB_OUTPUT"
echo "prerelease=${prerelease}" >> "$GITHUB_OUTPUT"
echo "attach_tag=${{ inputs.attach_linux_to_release }}" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- name: Setup Rust stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
- name: Install Linux packaging tools (rpm, desktop-file-utils, appimagetool)
run: |
sudo apt-get update
sudo apt-get install -y rpm desktop-file-utils file zsync
curl -fsSL https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -o /tmp/appimagetool
chmod +x /tmp/appimagetool
sudo mv /tmp/appimagetool /usr/local/bin/appimagetool
- name: Install npm dependencies and verify frontend/i18n
run: |
npm ci
npm run check:i18n
npm test
npm run build
- name: Verify Rust formatting, Clippy, and test suites (Linux)
run: |
cargo fmt --manifest-path src-tauri/Cargo.toml -- --check
cargo clippy --manifest-path src-tauri/Cargo.toml --no-default-features --features native-gui --all-targets -- -D warnings
cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --no-fail-fast
cargo test --manifest-path src-tauri/Cargo.toml --no-default-features --features native-gui --no-fail-fast
- name: Build Linux native release binary
env:
SSD_SENTINEL_UPDATE_REPO: ${{ github.repository }}
run: |
cargo build --manifest-path src-tauri/Cargo.toml --release --locked --no-default-features --features native-gui
- name: Verify zero forbidden C UI/SSL/D-Bus shared-library links & CLI smoke
run: |
ldd src-tauri/target/release/ssd-sentinel
if ldd src-tauri/target/release/ssd-sentinel | grep -Eiq "webkit|gtk|adwaita|qt|ssl|dbus|ayatana"; then
echo "Forbidden runtime library link detected"
exit 1
fi
./src-tauri/target/release/ssd-sentinel --version
./src-tauri/target/release/ssd-sentinel --cli status --snapshot-dir src-tauri/tests/fixtures --json >/dev/null
- name: Package .deb, .rpm, AppImage, portable .tar.gz and SHA256SUMS-linux.txt
run: |
set -euo pipefail
VERSION="$(grep '^version' src-tauri/Cargo.toml | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')"
mkdir -p release-assets-linux
./packaging/linux/build-deb.sh
cp dist/ssd-sentinel_*_amd64.deb release-assets-linux/
./packaging/linux/build-rpm.sh
cp dist/ssd-sentinel-*.rpm release-assets-linux/
APPIMAGE_EXTRACT_AND_RUN=1 ./packaging/linux/build-appimage.sh
cp dist/SSD-Sentinel-*-x86_64.AppImage release-assets-linux/
PORTABLE_NAME="ssd-sentinel-${VERSION}-linux-x86_64"
STAGE_DIR="/tmp/${PORTABLE_NAME}"
rm -rf "$STAGE_DIR"
mkdir -p "$STAGE_DIR/icons" "$STAGE_DIR/packaging/linux" "$STAGE_DIR/docs"
install -m755 src-tauri/target/release/ssd-sentinel "$STAGE_DIR/ssd-sentinel"
cp LICENSE "$STAGE_DIR/"
[[ -f THIRD_PARTY.md ]] && cp THIRD_PARTY.md "$STAGE_DIR/" || true
cp docs/LINUX.md "$STAGE_DIR/docs/"
cp packaging/linux/com.ssdsentinel.desktop.desktop \
packaging/linux/com.ssdsentinel.desktop.metainfo.xml \
packaging/linux/com.ssdsentinel.desktop.policy \
packaging/linux/99-ssd-sentinel.rules \
packaging/linux/uninstall.sh \
"$STAGE_DIR/packaging/linux/"
cp src-tauri/icons/32x32.png "$STAGE_DIR/icons/32x32.png"
cp src-tauri/icons/128x128.png "$STAGE_DIR/icons/128x128.png"
cp src-tauri/icons/icon.png "$STAGE_DIR/icons/256x256.png"
cat <<'EOF' > "$STAGE_DIR/install-portable.sh"
#!/usr/bin/env bash
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODE="${1:---user}"
if [[ "$MODE" == "--system" ]]; then
[[ "$EUID" -eq 0 ]] || { echo "--system requires root (use sudo)." >&2; exit 1; }
install -Dm755 "$HERE/ssd-sentinel" /usr/local/bin/ssd-sentinel
install -Dm644 "$HERE/packaging/linux/com.ssdsentinel.desktop.desktop" /usr/share/applications/com.ssdsentinel.desktop.desktop
install -Dm644 "$HERE/packaging/linux/com.ssdsentinel.desktop.metainfo.xml" /usr/share/metainfo/com.ssdsentinel.desktop.metainfo.xml
install -Dm644 "$HERE/packaging/linux/com.ssdsentinel.desktop.policy" /usr/share/polkit-1/actions/com.ssdsentinel.desktop.policy
install -Dm644 "$HERE/icons/32x32.png" /usr/share/icons/hicolor/32x32/apps/com.ssdsentinel.desktop.png
install -Dm644 "$HERE/icons/128x128.png" /usr/share/icons/hicolor/128x128/apps/com.ssdsentinel.desktop.png
install -Dm644 "$HERE/icons/256x256.png" /usr/share/icons/hicolor/256x256/apps/com.ssdsentinel.desktop.png
echo "Installed SSD Sentinel into /usr/local/bin/ssd-sentinel"
else
DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
install -Dm755 "$HERE/ssd-sentinel" "$HOME/.local/bin/ssd-sentinel"
install -Dm644 "$HERE/packaging/linux/com.ssdsentinel.desktop.desktop" "$DATA_HOME/applications/com.ssdsentinel.desktop.desktop"
install -Dm644 "$HERE/packaging/linux/com.ssdsentinel.desktop.metainfo.xml" "$DATA_HOME/metainfo/com.ssdsentinel.desktop.metainfo.xml"
install -Dm644 "$HERE/icons/32x32.png" "$DATA_HOME/icons/hicolor/32x32/apps/com.ssdsentinel.desktop.png"
install -Dm644 "$HERE/icons/128x128.png" "$DATA_HOME/icons/hicolor/128x128/apps/com.ssdsentinel.desktop.png"
install -Dm644 "$HERE/icons/256x256.png" "$DATA_HOME/icons/hicolor/256x256/apps/com.ssdsentinel.desktop.png"
echo "Installed SSD Sentinel into $HOME/.local/bin/ssd-sentinel"
fi
EOF
chmod +x "$STAGE_DIR/install-portable.sh"
tar -C /tmp -czf "release-assets-linux/${PORTABLE_NAME}.tar.gz" "${PORTABLE_NAME}"
rm -rf "$STAGE_DIR"
(cd release-assets-linux && sha256sum * > SHA256SUMS-linux.txt)
ls -lh release-assets-linux/
cat release-assets-linux/SHA256SUMS-linux.txt
- name: Upload Linux staging artifact (manual workflow_dispatch without target release)
if: github.event_name == 'workflow_dispatch' && inputs.attach_linux_to_release == ''
uses: actions/upload-artifact@v4
with:
name: ssd-sentinel-linux-staging-${{ inputs.tag }}
path: release-assets-linux/*
- name: Generate SLSA / GitHub Build Provenance Attestation (Linux)
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.attach_linux_to_release != '')
uses: actions/attest-build-provenance@v2
with:
subject-path: release-assets-linux/*
- name: Publish Linux Assets to Tag GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ steps.channel.outputs.prerelease == 'true' }}
generate_release_notes: true
files: |
release-assets-linux/*
- name: Attach Linux Assets to Existing GitHub Release
if: github.event_name == 'workflow_dispatch' && inputs.attach_linux_to_release != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ inputs.attach_linux_to_release }}" release-assets-linux/* --clobber