-
Notifications
You must be signed in to change notification settings - Fork 48
277 lines (240 loc) · 9.9 KB
/
release.yml
File metadata and controls
277 lines (240 loc) · 9.9 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
name: Release & Publish
on:
push:
tags:
- "v*"
jobs:
release:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-15-intel, macos-15, windows-2025]
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch secrets from Infisical
if: startsWith(matrix.os, 'windows-') || startsWith(matrix.os, 'macos-')
uses: Infisical/secrets-action@v1.0.15
with:
method: oidc
identity-id: ${{ vars.INFISICAL_IDENTITY_ID }}
env-slug: prod
project-slug: ${{ vars.INFISICAL_PROJECT_SLUG }}
- name: Authenticate with GCP
if: startsWith(matrix.os, 'windows-')
uses: google-github-actions/auth@v3
with:
project_id: ${{ vars.GCP_PROJECT_ID }}
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.13.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm
cache-dependency-path: "frontend/pnpm-lock.yaml"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- uses: taiki-e/install-action@just
- name: Install build dependencies (cached)
if: matrix.os == 'ubuntu-22.04'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: >-
libgdk-pixbuf-2.0-dev
libpango1.0-dev
libjavascriptcoregtk-4.1-dev
libatk1.0-dev
libsoup-3.0-dev
libwebkit2gtk-4.1-dev
librsvg2-dev
version: 1.0
- name: Install dependencies
run: just deps
- name: Import macOS code signing certificate
if: startsWith(matrix.os, 'macos-')
run: |
# Create variables
CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
echo -n "${{ env.APPLE_CODE_SIGNING_CERT }}" | base64 --decode -o $CERTIFICATE_PATH
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P '${{ env.APPLE_CODE_SIGNING_CERT_PASSWORD }}' -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
echo "APPLE_SIGNING_IDENTITY=$(security find-identity -v -p codesigning | grep "Piebald LLC" | awk -F '"' '{print $2}')" >> $GITHUB_ENV
# Write API key and set path in environment
API_KEY_PATH=$RUNNER_TEMP/apple-api-key
echo -n "${{ env.APP_STORE_CONNECT_API_KEY }}" | base64 --decode -o $API_KEY_PATH
echo "APPLE_API_KEY_PATH=$API_KEY_PATH" >> $GITHUB_ENV
- name: Build project
env:
APPLE_API_ISSUER: ${{ env.APP_STORE_CONNECT_API_KEY_ISSUER }}
APPLE_API_KEY: ${{ env.APP_STORE_CONNECT_API_KEY_ID }}
run: just build-all
- name: Codesign `gemini-cli-desktop-web` executable (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
codesign --force --options runtime \
--sign "$APPLE_SIGNING_IDENTITY" \
--timestamp \
--identifier ai.piebald.gemini-cli-desktop.web \
target/release/gemini-cli-desktop-web
- name: Create notarization archive for `gemini-cli-desktop-web` (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
cd target/release
case "${{ matrix.os }}" in
macos-15-intel) PLATFORM="macos-x64";;
macos-15) PLATFORM="macos-arm64";;
*) echo "Unsupported macOS: ${{ matrix.os }}"; exit 1;;
esac
zip "gemini-cli-desktop-web-${PLATFORM}.zip" gemini-cli-desktop-web
- name: Notarize `gemini-cli-desktop-web` archive (macOS)
if: startsWith(matrix.os, 'macos-')
env:
APPLE_API_ISSUER: ${{ env.APP_STORE_CONNECT_API_KEY_ISSUER }}
APPLE_API_KEY: ${{ env.APP_STORE_CONNECT_API_KEY_ID }}
run: |
cd target/release
case "${{ matrix.os }}" in
macos-15-intel) PLATFORM="macos-x64";;
macos-15) PLATFORM="macos-arm64";;
*) echo "Unsupported macOS: ${{ matrix.os }}"; exit 1;;
esac
xcrun notarytool submit "gemini-cli-desktop-web-${PLATFORM}.zip" \
--key "$APPLE_API_KEY_PATH" \
--key-id "$APPLE_API_KEY" \
--issuer "$APPLE_API_ISSUER" \
--wait
- name: Cleanup notarization archive for `gemini-cli-desktop-web` (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
cd target/release
case "${{ matrix.os }}" in
macos-15-intel) PLATFORM="macos-x64";;
macos-15) PLATFORM="macos-arm64";;
*) echo "Unsupported macOS: ${{ matrix.os }}"; exit 1;;
esac
rm "gemini-cli-desktop-web-${PLATFORM}.zip"
- name: Cleanup code signing certificate (macOS)
if: always() && startsWith(matrix.os, 'macos-')
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
rm $RUNNER_TEMP/apple-api-key || true
- name: Decode Windows code signing certificate
if: startsWith(matrix.os, 'windows-')
run: |
$certBytes = [System.Convert]::FromBase64String("${{ env.WINDOWS_CODE_SIGNING_CERT }}")
[System.IO.File]::WriteAllBytes("piebald_llc.crt", $certBytes)
- name: Add SignTool to PATH
if: startsWith(matrix.os, 'windows-')
uses: kamaranl/add-signtool-action@v1
- name: Install Google Cloud KMS CNG provider
if: startsWith(matrix.os, 'windows-')
run: |
Invoke-WebRequest -Uri https://github.com/GoogleCloudPlatform/kms-integrations/releases/download/cng-v1.3/kmscng-1.3-windows-amd64.zip -OutFile kmscng.zip
Expand-Archive -Path kmscng.zip -DestinationPath .
$proc = Start-Process "msiexec" "/i kmscng-1.3-windows-amd64\kmscng.msi /qn" -NoNewWindow -PassThru -Wait
Remove-Item -Path kmscng.zip,kmscng-1.3-windows-amd64 -Recurse -Force
exit $proc.ExitCode
- name: Sign Windows executables
if: startsWith(matrix.os, 'windows-')
run: |
signtool sign `
/v /debug /fd sha256 `
/t http://timestamp.digicert.com `
/f piebald_llc.crt `
/csp "Google Cloud KMS Provider" `
/kc ${{ vars.GCP_KMS_KEY }} `
target/release/gemini-cli-desktop.exe
signtool sign `
/v /debug /fd sha256 `
/t http://timestamp.digicert.com `
/f piebald_llc.crt `
/csp "Google Cloud KMS Provider" `
/kc ${{ vars.GCP_KMS_KEY }} `
target/release/gemini-cli-desktop-web.exe
- name: Archive `gemini-cli-desktop-web` executable (macOS/Linux)
if: matrix.os != 'windows-2025'
run: |
cd target/release
case "${{ matrix.os }}" in
ubuntu-22.04) PLATFORM="linux-x64-gnu";;
macos-15-intel) PLATFORM="macos-x64";;
macos-15) PLATFORM="macos-arm64";;
*) echo "Invalid OS: ${{ matrix.os }}"; exit 1;;
esac
tar -czf gemini-cli-desktop-web-${PLATFORM}.tar.gz gemini-cli-desktop-web
- name: Archive `gemini-cli-desktop-web` executable (Windows)
if: startsWith(matrix.os, 'windows-')
run: |
cd target/release
7z a -tzip gemini-cli-desktop-web-windows-x64-msvc.zip gemini-cli-desktop-web.exe
- name: Build Windows installer
if: startsWith(matrix.os, 'windows-')
run: iscc installer.iss
- name: Sign Windows installer
if: startsWith(matrix.os, 'windows-')
run: |
signtool sign `
/v /debug /fd sha256 `
/t http://timestamp.digicert.com `
/f piebald_llc.crt `
/csp "Google Cloud KMS Provider" `
/kc ${{ vars.GCP_KMS_KEY }} `
target/release/GeminiCLIDesktopSetup.exe
- name: Remove spaces from installer names
if: matrix.os != 'windows-2025'
run: |
cd target/release/bundle
find appimage rpm deb dmg -maxdepth 1 -type f -name 'Gemini CLI Desktop*' 2>/dev/null \
-exec bash -c '
for f; do
mv "$f" "$(dirname "$f")/$(basename "$f" | sed "s/^Gemini CLI Desktop/GeminiCLIDesktop/")"
done
' _ {} + || true
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: gemini-cli-desktop-${{ matrix.os }}
path: |
target/release/bundle/dmg/*.dmg
target/release/bundle/deb/*.deb
target/release/bundle/rpm/*.rpm
target/release/bundle/appimage/*.AppImage
target/release/GeminiCLIDesktopSetup.exe
target/release/gemini-cli-desktop-web-*.tar.gz
target/release/gemini-cli-desktop-web-*.zip
if-no-files-found: ignore
publish-release:
name: Publish GitHub Release
runs-on: ubuntu-22.04
needs: release
permissions:
contents: write
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/**/*
generate_release_notes: true
fail_on_unmatched_files: true