-
Notifications
You must be signed in to change notification settings - Fork 10
338 lines (287 loc) · 12 KB
/
build.yml
File metadata and controls
338 lines (287 loc) · 12 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
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to build (e.g., 2.0.4)'
required: true
type: string
permissions:
contents: write
actions: read
checks: write
env:
NODE_VERSION: '22'
jobs:
# Test stage - runs on Linux for speed
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci --prefer-offline
- name: Run linter
run: npm run lint
# Build stage - macOS with code signing
build-macos:
runs-on: macos-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Set version from tag
run: |
if [ -n "${{ inputs.version }}" ]; then
TAG_VERSION="${{ inputs.version }}"
else
TAG_VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "VERSION=$TAG_VERSION" >> $GITHUB_ENV
npm version $TAG_VERSION --no-git-tag-version --allow-same-version
- name: Install dependencies
run: npm ci --prefer-offline
- name: Prepare bundled llama runtime (macOS)
run: node scripts/prepare-llama-runtime.mjs --strict --targets=darwin-arm64,darwin-x64
- name: Verify required environment variables
run: |
if [ -z "${{ vars.APPLE_ID }}" ] || [ -z "${{ secrets.APPLE_PASSWORD }}" ] || [ -z "${{ secrets.APPLE_TEAM_ID }}" ] || [ -z "${{ secrets.SIGNING_IDENTITY }}" ]; then
echo "❌ Error: Missing required environment variables for code signing"
echo "Required: APPLE_ID (var), APPLE_PASSWORD, APPLE_TEAM_ID, SIGNING_IDENTITY (org secrets)"
exit 1
fi
- name: Import code signing certificate
run: |
echo "Importing code signing certificate..."
# Create temporary keychain
KEYCHAIN_PATH=$RUNNER_TEMP/ci-build.keychain-db
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
# Delete keychain if it exists
security delete-keychain "$KEYCHAIN_PATH" 2>/dev/null || true
# Create new temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Set keychain settings (no timeout, no lock)
security set-keychain-settings "$KEYCHAIN_PATH"
# Unlock keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Add to keychain search list
security list-keychains -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | sed s/\"//g)
# Import certificate
echo "${{ secrets.SIGNING_CERTIFICATE_BASE64 }}" | base64 -d > certificate.p12
security import certificate.p12 -k "$KEYCHAIN_PATH" -P "${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign -T /usr/bin/productbuild
rm certificate.p12
# Allow codesign to access the certificate without prompting
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Set default keychain
security default-keychain -s "$KEYCHAIN_PATH"
echo "✅ Certificate imported successfully"
- name: Verify environment variables
run: |
echo "Verifying environment variables..."
if [ -z "${{ secrets.FIGMA_CLIENT_ID }}" ] || [ -z "${{ secrets.FIGMA_CLIENT_SECRET }}" ]; then
echo "⚠️ Warning: FIGMA_CLIENT_ID or FIGMA_CLIENT_SECRET not set"
echo "OAuth authentication will not work in the built app"
else
echo "✅ Figma OAuth credentials configured"
fi
if [ -z "${{ secrets.GOOGLE_ANALYTICS_ID }}" ] || [ -z "${{ secrets.GOOGLE_ANALYTICS_API_SECRET }}" ]; then
echo "⚠️ Warning: Google Analytics credentials not set"
else
echo "✅ Google Analytics configured"
fi
- name: Build macOS universal app
run: npm run make -- --platform=darwin --arch=universal
env:
# Code signing credentials (org level)
APPLE_ID: ${{ vars.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}
# Runtime configuration (repo level)
FIGMA_CLIENT_ID: ${{ secrets.FIGMA_CLIENT_ID }}
FIGMA_CLIENT_SECRET: ${{ secrets.FIGMA_CLIENT_SECRET }}
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }}
GOOGLE_ANALYTICS_API_SECRET: ${{ secrets.GOOGLE_ANALYTICS_API_SECRET }}
# Analytics distribution channel
DISTRIBUTION_CHANNEL: ${{ secrets.DISTRIBUTION_CHANNEL }}
- name: Clean up keychain
if: always()
run: |
security delete-keychain $RUNNER_TEMP/ci-build.keychain-db 2>/dev/null || true
security default-keychain -s ~/Library/Keychains/login.keychain-db || true
- name: List build artifacts
run: |
echo "=== Build artifacts ==="
find out/make -type f
- name: Upload DMG artifact
uses: actions/upload-artifact@v6
with:
name: macos-universal-dmg
path: out/make/*.dmg
if-no-files-found: error
- name: Upload ZIP artifact
uses: actions/upload-artifact@v6
with:
name: macos-universal-zip
path: out/make/zip/darwin/universal/*.zip
if-no-files-found: error
# Backward-compat: apps older than v2.0.11 request the darwin-arm64 feed URL.
# Copy the universal ZIP under the arm64 filename so update.electronjs.org can serve them.
# This can be removed once no clients older than v2.0.11 remain in the wild.
- name: Create darwin-arm64 compatibility ZIP
run: |
UNIVERSAL_ZIP=$(find out/make/zip/darwin/universal -name "*.zip" | head -1)
BASENAME=$(basename "$UNIVERSAL_ZIP")
ARM64_BASENAME="${BASENAME/darwin-universal/darwin-arm64}"
mkdir -p out/make/zip/darwin/arm64-compat
cp "$UNIVERSAL_ZIP" "out/make/zip/darwin/arm64-compat/$ARM64_BASENAME"
echo "Created: out/make/zip/darwin/arm64-compat/$ARM64_BASENAME"
- name: Upload arm64 compatibility ZIP artifact
uses: actions/upload-artifact@v6
with:
name: macos-arm64-zip
path: out/make/zip/darwin/arm64-compat/*.zip
if-no-files-found: error
# Build stage - Windows
build-windows:
runs-on: windows-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Set version from tag
shell: bash
run: |
if [ -n "${{ inputs.version }}" ]; then
TAG_VERSION="${{ inputs.version }}"
else
TAG_VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "VERSION=$TAG_VERSION" >> $GITHUB_ENV
npm version $TAG_VERSION --no-git-tag-version --allow-same-version
- name: Install dependencies
run: npm ci --prefer-offline
- name: Prepare bundled llama runtime (Windows)
run: node scripts/prepare-llama-runtime.mjs --strict --targets=windows-x64
- name: Verify environment variables
shell: bash
run: |
echo "Verifying environment variables..."
if [ -z "${{ secrets.FIGMA_CLIENT_ID }}" ] || [ -z "${{ secrets.FIGMA_CLIENT_SECRET }}" ]; then
echo "⚠️ Warning: FIGMA_CLIENT_ID or FIGMA_CLIENT_SECRET not set"
echo "OAuth authentication will not work in the built app"
else
echo "✅ Figma OAuth credentials configured"
fi
if [ -z "${{ secrets.GOOGLE_ANALYTICS_ID }}" ] || [ -z "${{ secrets.GOOGLE_ANALYTICS_API_SECRET }}" ]; then
echo "⚠️ Warning: Google Analytics credentials not set"
else
echo "✅ Google Analytics configured"
fi
- name: Build Windows app
run: npm run make -- --platform=win32
env:
FIGMA_CLIENT_ID: ${{ secrets.FIGMA_CLIENT_ID }}
FIGMA_CLIENT_SECRET: ${{ secrets.FIGMA_CLIENT_SECRET }}
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }}
GOOGLE_ANALYTICS_API_SECRET: ${{ secrets.GOOGLE_ANALYTICS_API_SECRET }}
# Analytics distribution channel
DISTRIBUTION_CHANNEL: ${{ secrets.DISTRIBUTION_CHANNEL }}
- name: List build artifacts
shell: bash
run: |
echo "=== Build artifacts ==="
find out/make -type f
- name: Upload Windows artifacts
uses: actions/upload-artifact@v6
with:
name: windows-build
path: |
out/make/squirrel.windows/**/*.exe
out/make/squirrel.windows/**/*.nupkg
if-no-files-found: warn
# Create GitHub Release
create-release:
runs-on: ubuntu-latest
needs: [build-macos, build-windows]
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
- name: List downloaded artifacts
run: |
echo "=== Downloaded artifacts ==="
find artifacts -type f
- name: Extract version from tag
run: |
if [ -n "${{ inputs.version }}" ]; then
TAG_VERSION="${{ inputs.version }}"
TAG_NAME="v$TAG_VERSION"
else
TAG_VERSION=${GITHUB_REF#refs/tags/v}
TAG_NAME=${GITHUB_REF#refs/tags/}
fi
echo "VERSION=$TAG_VERSION" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.TAG_NAME }}
draft: false
prerelease: false
generate_release_notes: true
make_latest: true
name: TalkToFigma Desktop ${{ env.TAG_NAME }}
body: |
## TalkToFigma Desktop ${{ env.TAG_NAME }}
### 📦 Downloads
- **macOS DMG (Universal)**: Works on both Intel and Apple Silicon Macs
- **macOS ZIP (Universal)**: Alternative distribution format
- **Windows Squirrel**: Traditional EXE installer
### 🔒 Code Signing
- macOS builds are **code signed** with Grab Developer ID
- macOS builds are **notarized** by Apple
- Bundle ID: `com.grabtaxi.klever`
### 📋 Requirements
- macOS 10.15 (Catalina) or later
- Windows 10 or later
- Node.js 22+ (for MCP server)
### 🚀 What's New
See commit history and release notes below for details.
files: |
artifacts/macos-universal-dmg/*.dmg
artifacts/macos-universal-zip/**/*.zip
artifacts/macos-arm64-zip/**/*.zip
artifacts/windows-build/**/*.exe
artifacts/windows-build/**/*.nupkg
- name: Ensure release is published and latest
env:
GH_TOKEN: ${{ github.token }}
run: |
RELEASE_ID=$(gh api "repos/${{ github.repository }}/releases/tags/${{ env.TAG_NAME }}" --jq '.id')
gh api -X PATCH "repos/${{ github.repository }}/releases/${RELEASE_ID}" \
-f draft=false \
-f prerelease=false \
-f make_latest=true >/dev/null
echo "Release ${{ env.TAG_NAME }} published with draft=false and make_latest=true"