Repository navigation
125 lines (120 loc) · 5.08 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (120 loc) · 5.08 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
name: Release
# Push a tag like v0.2.0 (matching the version in Cargo.toml) to build, sign and publish.
on:
push:
tags: ["v*"]
env:
CARGO_TERM_COLOR: always
jobs:
linux:
name: Linux packages
# The oldest supported Ubuntu, so the binaries run on older systems too (glibc).
runs-on: ubuntu-22.04
# A stuck step (a package mirror not answering) fails within minutes, not after 6 hours.
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: System packages
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libwayland-dev dpkg-dev
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --locked --features gui --bins
- name: Package
run: |
v="${GITHUB_REF_NAME#v}"
name="cleancore-$v-linux-x86_64"
mkdir -p "out/$name"
cp target/release/cleancore target/release/cleancore-gui README.md LICENSE "out/$name/"
tar -C out -czf "out/$name.tar.gz" "$name"
packaging/linux/build-deb.sh "$v" target/release out
- uses: actions/upload-artifact@v4
with:
name: linux
path: |
out/*.tar.gz
out/*.deb
windows:
name: Windows package
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --locked --features gui --bins
- name: Package
shell: pwsh
run: |
$v = "$env:GITHUB_REF_NAME".TrimStart("v")
$files = "out/cleancore-$v-windows-x64"
New-Item -ItemType Directory -Force $files | Out-Null
# cleancore.com is what a terminal runs for `cleancore`; cleancore-gui.exe is a
# stand-in for updates from 0.2.8 and older (src/bin/cleancore-gui.rs).
Copy-Item target/release/cleancore.exe, target/release/cleancore-gui.exe, README.md, LICENSE $files
Copy-Item target/release/cleancore-console.exe "$files/cleancore.com"
Compress-Archive -Path "$files/*" -DestinationPath "$files.zip"
# The setup wizard (Inno Setup): cleancore-<version>-windows-x64-setup.exe
- name: Setup wizard
shell: pwsh
run: |
$v = "$env:GITHUB_REF_NAME".TrimStart("v")
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $iscc)) { choco install innosetup -y --no-progress }
& $iscc /Qp "/DAppVersion=$v" "/DBinDir=$pwd\target\release" "/DOutDir=$pwd\out" packaging\windows\cleancore.iss
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- uses: actions/upload-artifact@v4
with:
name: windows
path: |
out/*.zip
out/*-setup.exe
publish:
name: Sign and publish
needs: [linux, windows]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Tag matches Cargo.toml
run: |
want="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
test "${GITHUB_REF_NAME#v}" = "$want" || { echo "tag $GITHUB_REF_NAME but Cargo.toml says $want"; exit 1; }
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Checksums
working-directory: dist
run: sha256sum * > SHA256SUMS.txt && cat SHA256SUMS.txt
# The app installs an update only if SHA256SUMS.txt carries this signature.
- name: Sign
working-directory: dist
env:
MINISIGN_SECRET_KEY: ${{ secrets.MINISIGN_SECRET_KEY }}
run: |
# minisign from its own release, pinned by hash, rather than apt: refreshing the package
# lists can hang on a mirror (it held the 0.2.7 release for over 10 minutes).
url=https://github.com/jedisct1/minisign/releases/download/0.12/minisign-0.12-linux.tar.gz
curl -fsSL --retry 3 --max-time 60 -o "$RUNNER_TEMP/minisign.tar.gz" "$url"
echo "9a599b48ba6eb7b1e80f12f36b94ceca7c00b7a5173c95c3efc88d9822957e73 $RUNNER_TEMP/minisign.tar.gz" | sha256sum -c -
tar -xzf "$RUNNER_TEMP/minisign.tar.gz" -C "$RUNNER_TEMP"
minisign="$RUNNER_TEMP/minisign-linux/x86_64/minisign"
test -n "$MINISIGN_SECRET_KEY" || { echo "the MINISIGN_SECRET_KEY secret is not set"; exit 1; }
key="$(mktemp)"
printf '%s\n' "$MINISIGN_SECRET_KEY" > "$key"
"$minisign" -S -s "$key" -m SHA256SUMS.txt -t "CleanCore $GITHUB_REF_NAME"
rm -f "$key"
# Check it with the public key built into the app, so a wrong key never ships.
pub="$(sed -n 's/^pub const PUBLIC_KEY: &str = "\(.*\)";/\1/p' ../src/update.rs)"
"$minisign" -V -P "$pub" -m SHA256SUMS.txt
- name: Publish
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" dist/* --title "CleanCore ${GITHUB_REF_NAME#v}" --generate-notes