Repository navigation
270 lines (262 loc) · 9.77 KB
/
Copy pathrelease.yml
File metadata and controls
270 lines (262 loc) · 9.77 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
name: Release
# A v* tag builds every download, installs each one on a clean system to prove it works, and
# publishes them as that tag's GitHub release. Run by hand on a branch, it builds and tests the
# same files without publishing (`gh workflow run release.yml --ref BRANCH`); they are kept as the
# run's `release-all` artifact.
#
# macOS, Windows, and Linux x86_64 skip compilation when CI already built that commit. The
# programs are packaged and signed here. Linux aarch64 is built here; CI does not cover it.
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
publish:
description: Publish a GitHub release. Only when run on a v* tag.
type: boolean
default: false
permissions:
contents: read
actions: read
env:
CARGO_TERM_COLOR: always
jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- name: Name the files
run: packaging/ci-label.sh >> "$GITHUB_ENV"
- name: Reuse binaries built by CI
id: reuse
env:
GH_TOKEN: ${{ github.token }}
run: packaging/ci/reuse-binaries.sh macos
- uses: ./.github/actions/setup-rust
if: steps.reuse.outputs.found != 'true'
with:
cache-key: release
- name: Build release
if: steps.reuse.outputs.found != 'true'
env:
TINYCLIENT_TELEGRAM_API_ID: ${{ secrets.TINYCLIENT_TELEGRAM_API_ID }}
TINYCLIENT_TELEGRAM_API_HASH: ${{ secrets.TINYCLIENT_TELEGRAM_API_HASH }}
run: |
cargo build --release \
-p tinyclient --features tinyclient/gui \
-p chatd -p mediad -p login
- name: Bundle tinyclient.app
run: packaging/bundle.sh --no-build
- name: Zip and disk image
run: |
mkdir -p dist
ditto -c -k --keepParent target/release/tinyclient.app "dist/tinyclient-$LABEL-macos.zip"
packaging/dmg.sh "dist/tinyclient-$LABEL-macos.dmg"
# Mounted as a user would: the Applications link is there, the app's ad hoc signature holds,
# and every program in it runs.
- name: Smoke test the disk image
run: |
mnt=$(mktemp -d)
hdiutil attach -nobrowse -readonly -mountpoint "$mnt" "dist/tinyclient-$LABEL-macos.dmg"
test "$(readlink "$mnt/Applications")" = /Applications
codesign --verify --deep --strict --verbose=2 "$mnt/tinyclient.app"
codesign -dv "$mnt/tinyclient.app" 2>&1 | grep -q 'Signature=adhoc'
for program in tinyclient chatd mediad tinyclient-login; do
out=$("$mnt/tinyclient.app/Contents/MacOS/$program" --version)
echo "$out"
test "$out" = "$program $VERSION"
done
hdiutil detach "$mnt"
- uses: actions/upload-artifact@v6
with:
name: release-macos
path: dist/*
linux:
strategy:
fail-fast: false
matrix:
include:
# The oldest supported Ubuntu: the packages need the glibc they were built against or newer.
- arch: x86_64
runner: ubuntu-22.04
artifact: linux-x86_64
- arch: aarch64
runner: ubuntu-22.04-arm
artifact: linux-aarch64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
- name: Name the files
run: packaging/ci-label.sh >> "$GITHUB_ENV"
- name: Reuse binaries built by CI
id: reuse
env:
GH_TOKEN: ${{ github.token }}
run: packaging/ci/reuse-binaries.sh ${{ matrix.artifact }}
# Packaging reads the linked libraries even when the programs themselves came from CI.
- name: Install packaging dependencies
if: steps.reuse.outputs.found == 'true'
run: packaging/ci/apt.sh
- uses: ./.github/actions/setup-rust
if: steps.reuse.outputs.found != 'true'
with:
cache-key: release
- name: Build release
if: steps.reuse.outputs.found != 'true'
env:
TINYCLIENT_TELEGRAM_API_ID: ${{ secrets.TINYCLIENT_TELEGRAM_API_ID }}
TINYCLIENT_TELEGRAM_API_HASH: ${{ secrets.TINYCLIENT_TELEGRAM_API_HASH }}
run: |
cargo build --release \
-p tinyclient --features tinyclient/gui \
-p chatd -p mediad -p login
- name: Package .deb, .rpm, AppImage and .tar.gz
run: |
eval "$(packaging/linux/tools.sh)"
packaging/linux.sh --no-build "$LABEL"
- uses: actions/upload-artifact@v6
with:
name: release-linux-${{ matrix.arch }}
path: dist/*
# Each Linux package installed on clean systems that never saw the build: the package manager
# must find every library from the package's own dependencies, or the programs do not start.
linux-smoke:
needs: linux
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-24.04
image: ubuntu:24.04
kind: deb-full
- arch: x86_64
runner: ubuntu-24.04
image: debian:12
kind: deb
- arch: x86_64
runner: ubuntu-24.04
image: fedora:latest
kind: rpm
- arch: x86_64
runner: ubuntu-24.04
image: opensuse/tumbleweed
kind: rpm
- arch: aarch64
runner: ubuntu-24.04-arm
image: ubuntu:24.04
kind: deb-full
- arch: aarch64
runner: ubuntu-24.04-arm
image: debian:12
kind: deb
- arch: aarch64
runner: ubuntu-24.04-arm
image: fedora:latest
kind: rpm
- arch: aarch64
runner: ubuntu-24.04-arm
image: opensuse/tumbleweed
kind: rpm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
- name: Name the files
run: packaging/ci-label.sh >> "$GITHUB_ENV"
- uses: actions/download-artifact@v7
with:
name: release-linux-${{ matrix.arch }}
path: dist
- name: Install on ${{ matrix.image }}
run: docker run --rm -v "$PWD:/w" -w /w -e LABEL -e VERSION -e ARCH=${{ matrix.arch }} ${{ matrix.image }} packaging/linux/smoke.sh ${{ matrix.kind }}
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- name: Name the files
shell: bash
run: packaging/ci-label.sh >> "$GITHUB_ENV"
- name: Reuse binaries built by CI
id: reuse
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: packaging/ci/reuse-binaries.sh windows
- uses: ./.github/actions/setup-rust
if: steps.reuse.outputs.found != 'true'
with:
cache-key: release
- name: Build release
if: steps.reuse.outputs.found != 'true'
env:
TINYCLIENT_TELEGRAM_API_ID: ${{ secrets.TINYCLIENT_TELEGRAM_API_ID }}
TINYCLIENT_TELEGRAM_API_HASH: ${{ secrets.TINYCLIENT_TELEGRAM_API_HASH }}
run: |
cargo build --release `
-p tinyclient --features tinyclient/gui `
-p chatd -p mediad -p login
- name: Install Inno Setup
shell: pwsh
run: |
if (-not (Get-Command iscc.exe -ErrorAction SilentlyContinue) -and -not (Test-Path "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe")) {
choco install innosetup -y --no-progress
}
- name: Installer and portable zip
shell: pwsh
run: packaging/windows.ps1 -NoBuild -Label $env:LABEL
- name: Smoke test the installer and the zip
shell: pwsh
run: packaging/windows/smoke.ps1 -Label $env:LABEL -Version $env:VERSION
- uses: actions/upload-artifact@v6
with:
name: release-windows
path: dist/*
publish:
needs: [macos, linux, linux-smoke, windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Name the files
run: packaging/ci-label.sh >> "$GITHUB_ENV"
- uses: actions/download-artifact@v7
with:
pattern: release-*
path: dist
merge-multiple: true
# Each package also goes up without the version in its name, so a fixed address
# (releases/latest/download/tinyclient-macos.dmg, which tinyclient.io/download/macos points
# at) always serves the newest one. SHA256SUMS covers both names.
- name: Unversioned copies and checksums
working-directory: dist
run: |
for f in "tinyclient-$LABEL-"*; do
cp "$f" "tinyclient-${f#"tinyclient-$LABEL-"}"
done
sha256sum tinyclient-* > SHA256SUMS
sha256sum -c SHA256SUMS
ls -l
- uses: actions/upload-artifact@v6
with:
name: release-all
path: dist/*
- id: release
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag' && (github.event_name == 'push' || inputs.publish)
with:
files: dist/*
# The release lands in the community's #releases channel once the webhook's URL sits in
# the DISCORD_WEBHOOK_URL secret (an admin sets it). Nothing posts while it is unset, and
# a Discord hiccup does not fail a published release.
- name: Post the release to Discord
if: steps.release.outputs.url != ''
continue-on-error: true
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
RELEASE_URL: ${{ steps.release.outputs.url }}
run: |
[ -n "$DISCORD_WEBHOOK_URL" ] || exit 0
payload=$(jq -n --arg content "**tinyclient $VERSION is out.** Download: $RELEASE_URL Checksums are in SHA256SUMS on the release page." '{content: $content}')
curl -fsS -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL"