forked from desktop-plus/desktop-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
426 lines (383 loc) · 15.8 KB
/
Copy pathci-linux.yml
File metadata and controls
426 lines (383 loc) · 15.8 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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
name: 'CI (Linux)'
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
jobs:
arm64:
name: Ubuntu arm64
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref }}
submodules: recursive
- name: Package and test application in container
uses: pol-rivero/desktop-ubuntu-arm64-packaging@268f378f0fcea447cbb773ccf5bdc82f7389dcce
- name: Generate AppImage zsync
run: script/generate-appimage-zsync.sh dist/*.AppImage arm64 aarch64
- name: Upload output artifacts
uses: actions/upload-artifact@v4
with:
name: ubuntu-arm64-artifacts
path: |
dist/*.AppImage
dist/*.AppImage.zsync
dist/*.deb
dist/*.rpm
dist/*.sha256
retention-days: 5
if-no-files-found: error
arm:
name: Ubuntu arm
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref }}
submodules: recursive
- name: Package and test application in container
uses: pol-rivero/desktop-ubuntu-arm-packaging@2d4df8604295eb7bf767101c365435e7e029e3df
- name: Generate AppImage zsync
run: script/generate-appimage-zsync.sh dist/*.AppImage armv7l armhf
- name: Upload output artifacts
uses: actions/upload-artifact@v4
with:
name: ubuntu-arm-artifacts
path: |
dist/*.AppImage
dist/*.AppImage.zsync
dist/*.deb
dist/*.rpm
dist/*.sha256
retention-days: 5
if-no-files-found: error
amd64:
name: Ubuntu x64
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref }}
submodules: recursive
- name: Package and test application in container
uses: pol-rivero/desktop-ubuntu-amd64-packaging@fd44033e38ccc986e39ed8e7a6d38640506e8bde
- name: Generate AppImage zsync
run: script/generate-appimage-zsync.sh dist/*.AppImage x86_64 x86_64
- name: Upload output artifacts
uses: actions/upload-artifact@v4
with:
name: ubuntu-amd64-artifacts
path: |
dist/*.AppImage
dist/*.AppImage.zsync
dist/*.deb
dist/*.rpm
dist/*.sha256
retention-days: 5
if-no-files-found: error
release_github:
name: Create GitHub release
needs: [arm64, arm, amd64]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: './artifacts'
- name: Display structure of downloaded files
run: ls -R
working-directory: './artifacts'
- name: Get tag name without prefix
run: |
RELEASE_TAG=${GITHUB_REF/refs\/tags\//}
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
if [[ "${RELEASE_TAG}" == release-* ]]; then
tagNameWithoutPrefix="${RELEASE_TAG:8}"
else
tagNameWithoutPrefix="${RELEASE_TAG}"
fi
VERSION_WITHOUT_V=$(echo "${tagNameWithoutPrefix}" | sed -E "s/v(.*)/\\1/")
echo "VERSION_WITHOUT_V=${VERSION_WITHOUT_V}" >> $GITHUB_ENV
# Export for downstream jobs
echo "${VERSION_WITHOUT_V}" > VERSION_WITHOUT_V.txt
# GitHubDesktop-linux-<arch>-<old_version>.<ext> -> GitHubDesktopPlus-<release_tag>-linux-<arch>.<ext>
# GitHubDesktop-linux-<arch>-<old_version>-beta1.<ext> -> GitHubDesktopPlus-<release_tag>-linux-<arch>.<ext>
- name: Rename artifacts
run: |
for file in $(find ./artifacts -type f -name "GitHubDesktop-linux-*"); do
new_name=$(echo "$file" | sed -E "s/GitHubDesktop-linux-(.*)-[0-9]+\\.[0-9]+\\.[0-9]+(-beta[0-9]+)?\\.(.*)/GitHubDesktopPlus-${{ env.RELEASE_TAG }}-linux-\\1.\\3/")
new_name=$(echo $new_name | sed -E "s/linux-amd64/linux-x86_64/")
new_name=$(echo $new_name | sed -E "s/linux-aarch64/linux-arm64/")
mv --verbose "$file" "$new_name"
done
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: GitHub Desktop Plus v${{ env.VERSION_WITHOUT_V }}
body: |
Upstream: [GitHub Desktop ${{ env.VERSION_WITHOUT_V }} release notes](https://github.com/desktop/desktop/releases/tag/release-${{ env.VERSION_WITHOUT_V }})
files: |
artifacts/**/*.AppImage
artifacts/**/*.AppImage.zsync
artifacts/**/*.deb
artifacts/**/*.rpm
draft: false
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload VERSION_WITHOUT_V artifact
uses: actions/upload-artifact@v4
with:
name: VERSION_WITHOUT_V
path: VERSION_WITHOUT_V.txt
retention-days: 1
if-no-files-found: error
release_aur:
name: Publish AUR package
needs: release_github
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: './artifacts'
- name: Download VERSION_WITHOUT_V artifact
uses: actions/download-artifact@v4
with:
name: VERSION_WITHOUT_V
path: './'
- name: Set VERSION_WITHOUT_V env var
run: |
echo "VERSION_WITHOUT_V=$(cat ./VERSION_WITHOUT_V.txt)" >> $GITHUB_ENV
- name: Rename artifacts
run: |
for file in $(find ./artifacts -type f -name "GitHubDesktop-linux-*"); do
new_name=$(echo "$file" | sed -E "s/GitHubDesktop-linux-(.*)-[0-9]+\\.[0-9]+\\.[0-9]+(-beta[0-9]+)?\\.(.*)/GitHubDesktopPlus-v${{ env.VERSION_WITHOUT_V }}-linux-\\1.\\3/")
new_name=$(echo $new_name | sed -E "s/linux-amd64/linux-x86_64/")
new_name=$(echo $new_name | sed -E "s/linux-aarch64/linux-arm64/")
mv --verbose "$file" "$new_name"
done
- name: Prepare PKGBUILD files
run: |
AUR_DIR=./publish/aur
echo "AUR_DIR=$AUR_DIR" >> $GITHUB_ENV
PKGBUILD_BIN=$AUR_DIR/PKGBUILD-bin.sh
PKGBUILD=$AUR_DIR/PKGBUILD.sh
PKGBUILD_GIT=$AUR_DIR/PKGBUILD-git.sh
echo "PKGBUILD_BIN=$PKGBUILD_BIN" >> $GITHUB_ENV
echo "PKGBUILD=$PKGBUILD" >> $GITHUB_ENV
echo "PKGBUILD_GIT=$PKGBUILD_GIT" >> $GITHUB_ENV
node_major=$(head -n 1 .node-version | cut -d. -f1)
NODE_CODENAME="$(
curl -fsSL https://raw.githubusercontent.com/nodejs/Release/main/schedule.json |
jq -r --arg v "v${node_major}" '.[$v].codename // empty' |
tr '[:upper:]' '[:lower:]'
)"
for PKGBUILD_FILE in "$PKGBUILD_BIN" "$PKGBUILD" "$PKGBUILD_GIT"; do
if [[ ! -f "$PKGBUILD_FILE" ]]; then
echo "$PKGBUILD_FILE does not exist. Contents of current directory:"
ls -la
exit 1
fi
sed -i "s/\[\[VERSION_WITHOUT_V\]\]/${VERSION_WITHOUT_V}/" $PKGBUILD_FILE
sed -i "s/\[\[NODE_CODENAME\]\]/${NODE_CODENAME}/" $PKGBUILD_FILE
desktop_file_sha256=$(sha256sum $AUR_DIR/github-desktop-plus.desktop | awk '{ print $1 }')
sed -i "s/\[\[DESKTOP_FILE_SHA256\]\]/$desktop_file_sha256/" $PKGBUILD_FILE
launch_script_sha256=$(sha256sum $AUR_DIR/launch-app.sh | awk '{ print $1 }')
sed -i "s/\[\[LAUNCH_SCRIPT_SHA256\]\]/$launch_script_sha256/" $PKGBUILD_FILE
x86_64_sha256=$(sha256sum artifacts/**/*-x86_64.deb | awk '{ print $1 }')
sed -i "s/\[\[X86_64_SHA256\]\]/$x86_64_sha256/" $PKGBUILD_FILE
aarch64_sha256=$(sha256sum artifacts/**/*-arm64.deb | awk '{ print $1 }')
sed -i "s/\[\[AARCH64_SHA256\]\]/$aarch64_sha256/" $PKGBUILD_FILE
armv7h_sha256=$(sha256sum artifacts/**/*-armhf.deb | awk '{ print $1 }')
sed -i "s/\[\[ARMV7H_SHA256\]\]/$armv7h_sha256/" $PKGBUILD_FILE
done
- name: Publish AUR package github-desktop-plus-bin
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
with:
pkgname: github-desktop-plus-bin
pkgbuild: ${{ env.PKGBUILD_BIN }}
assets: |
${{ env.AUR_DIR }}/.gitignore
${{ env.AUR_DIR }}/github-desktop-plus.desktop
${{ env.AUR_DIR }}/launch-app.sh
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message:
'Update AUR package to version v${{ env.VERSION_WITHOUT_V }}'
ssh_keyscan_types: rsa,ecdsa,ed25519
- name: Publish AUR package github-desktop-plus
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
with:
pkgname: github-desktop-plus
pkgbuild: ${{ env.PKGBUILD }}
assets: |
${{ env.AUR_DIR }}/.gitignore
${{ env.AUR_DIR }}/github-desktop-plus.desktop
${{ env.AUR_DIR }}/launch-app.sh
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message:
'Update AUR package to version v${{ env.VERSION_WITHOUT_V }}'
ssh_keyscan_types: rsa,ecdsa,ed25519
- name: Publish AUR package github-desktop-plus-git
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
with:
pkgname: github-desktop-plus-git
pkgbuild: ${{ env.PKGBUILD_GIT }}
assets: |
${{ env.AUR_DIR }}/.gitignore
${{ env.AUR_DIR }}/github-desktop-plus.desktop
${{ env.AUR_DIR }}/launch-app.sh
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message:
'Update AUR package to version v${{ env.VERSION_WITHOUT_V }}'
ssh_keyscan_types: rsa,ecdsa,ed25519
- name: Upload PKGBUILD files
uses: actions/upload-artifact@v4
with:
name: PKGBUILDs
path: |
${{ env.PKGBUILD_BIN }}
${{ env.PKGBUILD }}
${{ env.PKGBUILD_GIT }}
retention-days: 5
if-no-files-found: error
release_rpm:
name: Publish RPM package
needs: release_github
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: read
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: './artifacts'
- name: Install RPM package tools and s3cmd
run: |
sudo apt-get update
sudo apt-get install -y createrepo-c rpm s3cmd
- name: Import GPG private key and configure RPM signing
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "default-key $(gpg --list-keys --with-colons | grep pub | head -n1 | cut -d: -f5)" >> ~/.gnupg/gpg.conf
# https://unix.stackexchange.com/a/329107
echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf
gpg-connect-agent reloadagent /bye
echo '%_signature gpg' >> ~/.rpmmacros
echo '%_gpg_name ${{ secrets.GPG_KEY_NAME }}' >> ~/.rpmmacros
echo '%_gpgbin /usr/bin/gpg' >> ~/.rpmmacros
KEYGRIP=$(gpg --list-keys --with-keygrip --with-colons | awk -F: -v name="${{ secrets.GPG_KEY_NAME }}" '$1=="grp"{kg=$10} $1=="uid" && index($10,name){print kg; exit}')
"$(gpgconf --list-dirs libexecdir)"/gpg-preset-passphrase --passphrase "${{ secrets.GPG_KEY_PASSPHRASE }}" --preset $KEYGRIP
- name: Prepare RPM repository
run: |
mkdir dist
cd dist
mkdir Packages
# Copy and sign RPM packages
find ../artifacts -type f -name "*.rpm" -exec cp {} Packages/ \;
for rpm in Packages/*.rpm; do
rpm --addsign "$rpm"
done
# Create and sign release
createrepo_c --update .
gpg --batch --yes --detach-sign -o repodata/repomd.xml.asc repodata/repomd.xml
- name: Configure s3cmd for Cloudflare R2
run: |
cat > ~/.s3cfg <<EOF
[default]
access_key = ${{ secrets.R2_ACCESS_KEY_ID }}
secret_key = ${{ secrets.R2_SECRET_ACCESS_KEY }}
host_base = ${{ secrets.R2_ENDPOINT }}
host_bucket = ${{ secrets.R2_ENDPOINT }}
use_https = True
signature_v2 = False
EOF
- name: Sync RPM repo to Cloudflare R2
working-directory: dist
run: |
s3cmd sync --delete-removed ./ s3://${{ secrets.R2_BUCKET_RPM }}/
release_deb:
name: Publish DEB package
needs: release_github
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: read
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: './artifacts'
- name: Install Debian repo tools and s3cmd
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev apt-utils s3cmd
- name: Import GPG private key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "default-key $(gpg --list-keys --with-colons | grep pub | head -n1 | cut -d: -f5)" >> ~/.gnupg/gpg.conf
- name: Prepare APT repository
run: |
mkdir dist
cd dist
# Copy .deb packages into pool
mkdir -p pool/main
find ../artifacts -type f -name "*.deb" -exec cp {} pool/main/ \;
# Normalize package names
dpkg-name pool/main/*.deb
# Generate the Packages index for each architecture
for arch in amd64 arm64 armhf; do
mkdir -p dists/stable/main/binary-$arch
dpkg-scanpackages --arch $arch pool/main /dev/null > dists/stable/main/binary-$arch/Packages
gzip -k dists/stable/main/binary-$arch/Packages
done
# Create the Release file
apt-ftparchive -o APT::FTPArchive::Release::Codename=stable release dists/stable > dists/stable/Release
# Sign release file
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_KEY_PASSPHRASE }}" --clearsign -o dists/stable/InRelease dists/stable/Release
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_KEY_PASSPHRASE }}" --detach-sign -o dists/stable/Release.gpg dists/stable/Release
- name: Configure s3cmd for Cloudflare R2
run: |
cat > ~/.s3cfg <<EOF
[default]
access_key = ${{ secrets.R2_ACCESS_KEY_ID }}
secret_key = ${{ secrets.R2_SECRET_ACCESS_KEY }}
host_base = ${{ secrets.R2_ENDPOINT }}
host_bucket = ${{ secrets.R2_ENDPOINT }}
use_https = True
signature_v2 = False
EOF
- name: Sync DEB repo to Cloudflare R2
working-directory: dist
run: |
s3cmd sync --delete-removed ./ s3://${{ secrets.R2_BUCKET_APT }}/