-
-
Notifications
You must be signed in to change notification settings - Fork 100
379 lines (316 loc) · 12.3 KB
/
build.yml
File metadata and controls
379 lines (316 loc) · 12.3 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
name: Build TablePro
on:
push:
tags: ["v*"]
paths-ignore:
- "**.md"
- "docs/**"
- ".vscode/**"
env:
XCODE_PROJECT: TablePro.xcodeproj
XCODE_SCHEME: TablePro
BUILD_CONFIGURATION: Release
jobs:
lint:
name: SwiftLint
runs-on: macos-15
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install SwiftLint
run: brew list swiftlint &>/dev/null || brew install swiftlint
- name: Run SwiftLint
run: swiftlint lint --strict
build-arm64:
name: Build ARM64
runs-on: macos-15
needs: lint
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.2'
- name: Download static libraries
env:
GH_TOKEN: ${{ github.token }}
run: scripts/download-libs.sh --force
- name: Install ARM64 dependencies
run: |
echo "Installing ARM64 dependencies..."
# Check and install only if needed
if ! brew list mariadb-connector-c &>/dev/null; then
echo "📦 Installing mariadb-connector-c..."
brew install mariadb-connector-c
else
echo "✅ mariadb-connector-c already installed"
fi
# Link packages with --force and --overwrite (needed for keg-only formulas)
brew link --force --overwrite mariadb-connector-c 2>/dev/null || true
echo "✅ ARM64 dependencies installed"
- name: Prepare libraries
run: scripts/ci/prepare-libs.sh arm64
- name: Verify Xcode
run: |
echo "Active Xcode:"
xcode-select -p
xcodebuild -version
- name: Create Secrets.xcconfig
env:
ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }}
run: echo "ANALYTICS_HMAC_SECRET = ${ANALYTICS_HMAC_SECRET}" > Secrets.xcconfig
- name: Import signing certificate
env:
CERTIFICATES_P12: ${{ secrets.CERTIFICATES_P12 }}
CERTIFICATES_PASSWORD: ${{ secrets.CERTIFICATES_PASSWORD }}
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
security create-keychain -p "" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "" "$KEYCHAIN_PATH"
echo "$CERTIFICATES_P12" | base64 --decode > $RUNNER_TEMP/certificate.p12
security import $RUNNER_TEMP/certificate.p12 -P "$CERTIFICATES_PASSWORD" \
-A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple: -k "" "$KEYCHAIN_PATH"
security list-keychain -d user -s "$KEYCHAIN_PATH" login.keychain
- name: Configure notarization
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }}
run: |
xcrun notarytool store-credentials "TablePro" \
--apple-id "$APPLE_ID" \
--team-id "$APPLE_TEAM_ID" \
--password "$NOTARY_PASSWORD"
- name: Install provisioning profile
env:
PROVISIONING_PROFILE: ${{ secrets.PROVISIONING_PROFILE }}
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo "$PROVISIONING_PROFILE" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/tablepro.provisionprofile
- name: Build ARM64
env:
ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }}
NOTARIZE: "true"
run: |
chmod +x scripts/build-release.sh
scripts/build-release.sh arm64
- name: Verify build
run: scripts/ci/verify-build.sh arm64
- name: Package artifacts
env:
NOTARIZE: "true"
run: scripts/ci/package-artifacts.sh arm64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-arm64
path: |
build/Release/TablePro-*.dmg
build/Release/TablePro-*.zip
build-x86_64:
name: Build x86_64
runs-on: macos-15
needs: lint
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.2'
- name: Download static libraries
env:
GH_TOKEN: ${{ github.token }}
run: scripts/download-libs.sh --force
- name: Install Rosetta 2
run: softwareupdate --install-rosetta --agree-to-license || true
- name: Install x86_64 Homebrew
run: |
if [ ! -f /usr/local/bin/brew ]; then
echo "Installing x86_64 Homebrew..."
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
- name: Install x86_64 dependencies
run: |
echo "Installing x86_64 dependencies..."
# Check and install only if needed
if ! arch -x86_64 /usr/local/bin/brew list mariadb-connector-c &>/dev/null; then
echo "📦 Installing mariadb-connector-c (x86_64)..."
arch -x86_64 /usr/local/bin/brew install mariadb-connector-c
else
echo "✅ mariadb-connector-c (x86_64) already installed"
fi
# Link packages with --force (needed for keg-only formulas)
arch -x86_64 /usr/local/bin/brew link --force --overwrite mariadb-connector-c 2>/dev/null || true
echo "✅ x86_64 dependencies installed"
- name: Prepare libraries
run: scripts/ci/prepare-libs.sh x86_64
- name: Verify Xcode
run: |
echo "Active Xcode:"
xcode-select -p
xcodebuild -version
- name: Create Secrets.xcconfig
env:
ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }}
run: echo "ANALYTICS_HMAC_SECRET = ${ANALYTICS_HMAC_SECRET}" > Secrets.xcconfig
- name: Import signing certificate
env:
CERTIFICATES_P12: ${{ secrets.CERTIFICATES_P12 }}
CERTIFICATES_PASSWORD: ${{ secrets.CERTIFICATES_PASSWORD }}
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
security create-keychain -p "" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "" "$KEYCHAIN_PATH"
echo "$CERTIFICATES_P12" | base64 --decode > $RUNNER_TEMP/certificate.p12
security import $RUNNER_TEMP/certificate.p12 -P "$CERTIFICATES_PASSWORD" \
-A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple: -k "" "$KEYCHAIN_PATH"
security list-keychain -d user -s "$KEYCHAIN_PATH" login.keychain
- name: Configure notarization
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
NOTARY_PASSWORD: ${{ secrets.NOTARY_PASSWORD }}
run: |
xcrun notarytool store-credentials "TablePro" \
--apple-id "$APPLE_ID" \
--team-id "$APPLE_TEAM_ID" \
--password "$NOTARY_PASSWORD"
- name: Install provisioning profile
env:
PROVISIONING_PROFILE: ${{ secrets.PROVISIONING_PROFILE }}
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo "$PROVISIONING_PROFILE" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/tablepro.provisionprofile
- name: Build x86_64
env:
ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }}
NOTARIZE: "true"
run: |
chmod +x scripts/build-release.sh
scripts/build-release.sh x86_64
- name: Verify build
run: scripts/ci/verify-build.sh x86_64
- name: Package artifacts
env:
NOTARIZE: "true"
run: scripts/ci/package-artifacts.sh x86_64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-x86_64
path: |
build/Release/TablePro-*.dmg
build/Release/TablePro-*.zip
release:
name: Create GitHub Release
runs-on: macos-15
needs: [build-arm64, build-x86_64]
if: startsWith(github.ref, 'refs/tags/v')
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.2'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts-raw/
merge-multiple: true
- name: Flatten artifacts
run: |
mkdir -p artifacts/
find artifacts-raw/ -type f \( -name "*.dmg" -o -name "*.zip" \) -exec mv {} artifacts/ \;
rm -rf artifacts-raw/
echo "Artifacts:"
ls -lh artifacts/
- name: Verify and organize artifacts for release
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [ -z "$VERSION" ]; then
echo "❌ ERROR: Failed to extract version from ref: $GITHUB_REF"
exit 1
fi
echo "Preparing artifacts for version: $VERSION"
echo "Contents of artifacts directory:"
ls -la artifacts/
# Note: DMG files should already have correct names from build
# ZIP files need to be renamed
# Rename ZIP files if they exist
if [ -f "artifacts/TablePro-arm64.zip" ]; then
mv artifacts/TablePro-arm64.zip "artifacts/TablePro-${VERSION}-arm64.zip"
fi
if [ -f "artifacts/TablePro-x86_64.zip" ]; then
mv artifacts/TablePro-x86_64.zip "artifacts/TablePro-${VERSION}-x86_64.zip"
fi
echo "✅ Artifacts organized successfully"
echo "Final artifacts:"
ls -lh artifacts/
- name: Sign update archives with Sparkle
if: env.SPARKLE_PRIVATE_KEY != ''
env:
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: scripts/ci/sign-and-appcast.sh "${GITHUB_REF#refs/tags/v}"
- name: Upload appcast artifact
if: env.SPARKLE_PRIVATE_KEY != ''
uses: actions/upload-artifact@v4
env:
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
with:
name: appcast-${{ github.sha }}
path: appcast/appcast.xml
retention-days: 90
- name: Commit appcast.xml to repo
if: env.SPARKLE_PRIVATE_KEY != ''
continue-on-error: true
env:
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: |
if [ ! -f appcast/appcast.xml ]; then
echo "⚠️ No appcast.xml to commit"
exit 0
fi
cp appcast/appcast.xml appcast.xml
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin main
git checkout main
git add appcast.xml
git diff --cached --quiet && echo "No changes to appcast.xml" && exit 0
git commit -m "Update appcast.xml for v${GITHUB_REF#refs/tags/v}"
git push origin main
- name: Extract release notes from CHANGELOG.md
run: scripts/ci/extract-release-notes.sh "${GITHUB_REF#refs/tags/v}"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*.dmg
artifacts/*.zip
body_path: release_notes.md
draft: false
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Telegram
if: success() && env.TELEGRAM_BOT_TOKEN != ''
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }}
run: scripts/ci/notify-telegram.sh "${GITHUB_REF#refs/tags/v}"