-
Notifications
You must be signed in to change notification settings - Fork 2
149 lines (130 loc) · 4.68 KB
/
Copy pathpatch-linux-release.yml
File metadata and controls
149 lines (130 loc) · 4.68 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
name: Patch Linux Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version to rebuild and replace (for example 0.0.1 or v0.0.1)"
required: true
type: string
ref:
description: "Git ref to rebuild from (defaults to the release tag)"
required: false
default: ""
type: string
permissions:
contents: write
id-token: write
jobs:
patch_linux_release:
name: Patch Linux x64 Assets
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- id: release_meta
name: Resolve release version
shell: bash
run: |
raw="${{ github.event.inputs.version }}"
checkout_ref="${{ github.event.inputs.ref }}"
version="${raw#v}"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid release version: $raw" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
if [[ -z "$checkout_ref" ]]; then
checkout_ref="refs/tags/v$version"
fi
echo "checkout_ref=$checkout_ref" >> "$GITHUB_OUTPUT"
- name: Checkout release source
uses: actions/checkout@v6
with:
ref: ${{ steps.release_meta.outputs.checkout_ref }}
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- name: Cache Bun and Turbo
uses: actions/cache@v5
with:
path: |
~/.bun/install/cache
.turbo
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-${{ hashFiles('turbo.json', 'apps/*/turbo.jsonc') }}
restore-keys: |
${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-
- name: Cache Electron builder artifacts
uses: actions/cache@v5
with:
path: |
~/.cache/electron
~/.cache/electron-builder
key: ${{ runner.os }}-electron-builder-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-electron-builder-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Linux AppImage update tooling
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y zsync
mkdir -p "${RUNNER_TEMP}/appimage-tools"
curl -L \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage \
-o "${RUNNER_TEMP}/appimage-tools/appimagetool-x86_64.AppImage"
chmod +x "${RUNNER_TEMP}/appimage-tools/appimagetool-x86_64.AppImage"
- name: Align package versions to release version
run: node scripts/update-release-package-versions.ts "${{ steps.release_meta.outputs.version }}"
- name: Build Linux x64 artifacts
shell: bash
env:
T3CODE_APPIMAGETOOL: ${{ runner.temp }}/appimage-tools/appimagetool-x86_64.AppImage
run: |
bun run dist:desktop:artifact -- \
--platform linux \
--target AppImage \
--arch x64 \
--build-version "${{ steps.release_meta.outputs.version }}" \
--verbose
- name: Verify Linux AppImage update metadata
shell: bash
run: |
set -euo pipefail
appimage=$(find release -maxdepth 1 -type f -name '*.AppImage' | head -n1)
if [[ -z "$appimage" ]]; then
echo "Linux AppImage was not produced." >&2
exit 1
fi
update_info=$("$appimage" --appimage-updateinformation)
printf '%s\n' "$update_info"
[[ "$update_info" == gh-releases-zsync\|boggedbrush\|KodoCode\|latest\|Kodo-Code-\*-x86_64.AppImage.zsync ]]
- name: Collect patched Linux release assets
shell: bash
run: |
set -euo pipefail
mkdir -p release-publish
shopt -s nullglob
for pattern in \
"release/*.AppImage" \
"release/*.AppImage.zsync" \
"release/latest-linux.yml"; do
for file in $pattern; do
cp "$file" release-publish/
done
done
shopt -u nullglob
ls -la release-publish
- name: Upload patched Linux assets to existing release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ steps.release_meta.outputs.tag }}" release-publish/* --clobber