-
Notifications
You must be signed in to change notification settings - Fork 3
434 lines (373 loc) · 17 KB
/
Copy pathnightly.yaml
File metadata and controls
434 lines (373 loc) · 17 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
427
428
429
430
431
432
433
434
name: Nightly Build
on:
schedule:
- cron: "0 6 * * *" # 6 AM UTC daily
workflow_dispatch:
permissions:
contents: write
concurrency:
group: nightly
cancel-in-progress: true
env:
NODE_OPTIONS: "--max-old-space-size=4096"
GO_VERSION: "1.26"
NODE_VERSION: "24"
PNPM_VERSION: "10"
jobs:
# ─────────────────────────────────────────────────────────────────────────────
# Skip if no commits in the last 24 hours (unless manual dispatch)
# ─────────────────────────────────────────────────────────────────────────────
check-changes:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.check.outputs.should_build }}
nightly_version: ${{ steps.check.outputs.nightly_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for recent commits
id: check
shell: bash
run: |
NIGHTLY_VERSION="0.0.0-nightly.$(date -u +%Y%m%d)"
echo "nightly_version=${NIGHTLY_VERSION}" >> "$GITHUB_OUTPUT"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should_build=true" >> "$GITHUB_OUTPUT"
exit 0
fi
LAST_COMMIT=$(git log -1 --format=%ct)
NOW=$(date +%s)
DIFF=$((NOW - LAST_COMMIT))
if [ "$DIFF" -lt 86400 ]; then
echo "should_build=true" >> "$GITHUB_OUTPUT"
else
echo "should_build=false" >> "$GITHUB_OUTPUT"
echo "No commits in the last 24 hours — skipping nightly build"
fi
# ─────────────────────────────────────────────────────────────────────────────
# macOS (darwin/universal) — sign, notarize, DMG
# ─────────────────────────────────────────────────────────────────────────────
build-macos:
runs-on: macos-latest
needs: check-changes
if: needs.check-changes.outputs.should_build == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: |
- args: []
- args: [--global, typescript]
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: "go.sum"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Wails v3
shell: bash
run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest
- name: Build frontend
shell: bash
run: task common:build:frontend
- name: Build Omniview
shell: bash
env:
CGO_ENABLED: "1"
CGO_CFLAGS: "-mmacosx-version-min=10.15"
CGO_LDFLAGS: "-mmacosx-version-min=10.15"
MACOSX_DEPLOYMENT_TARGET: "10.15"
run: |
go build -tags production -trimpath -buildvcs=false \
-ldflags "-w -s \
-X github.com/omniviewdev/omniview/internal/version.Version=${{ needs.check-changes.outputs.nightly_version }} \
-X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \
-X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
-X github.com/omniviewdev/omniview/internal/version.Development=true \
-X github.com/omniviewdev/omniview/internal/telemetry.buildOTLPEndpoint=${{ secrets.TELEMETRY_OTLP_ENDPOINT }} \
-X github.com/omniviewdev/omniview/internal/telemetry.buildPyroscopeEndpoint=${{ secrets.TELEMETRY_PYROSCOPE_ENDPOINT }}" \
-o bin/Omniview .
- name: Create macOS .app bundle
run: |
task common:generate:icons
mkdir -p bin/Omniview.app/Contents/MacOS
mkdir -p bin/Omniview.app/Contents/Resources
cp build/darwin/icons.icns bin/Omniview.app/Contents/Resources/
cp bin/Omniview bin/Omniview.app/Contents/MacOS/
cp build/darwin/Info.plist bin/Omniview.app/Contents/
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Sign and Notarize
shell: bash
env:
APPLE_SIGN_ID: ${{ secrets.APPLE_DEVELOPER_SIGN_ID }}
NOTARY_USER: ${{ secrets.CLI_MACOS_NOTARY_USER }}
NOTARY_PWD: ${{ secrets.CLI_MACOS_NOTARY_PWD }}
TEAM_ID: ${{ secrets.CLI_MACOS_TEAM_ID }}
run: |
codesign --deep --force \
--options runtime \
--entitlements build/darwin/entitlements.plist \
--sign "$APPLE_SIGN_ID" \
bin/Omniview.app
ditto -c -k --keepParent --rsrc bin/Omniview.app archive.zip
xcrun notarytool submit archive.zip \
--apple-id "$NOTARY_USER" \
--password "$NOTARY_PWD" \
--team-id "$TEAM_ID" \
--wait
xcrun stapler staple bin/Omniview.app
- name: Checkout create-dmg
uses: actions/checkout@v4
with:
repository: create-dmg/create-dmg
path: ./build/create-dmg
ref: master
- name: Create DMG
shell: bash
working-directory: ./build
run: |
VERSION="${{ needs.check-changes.outputs.nightly_version }}"
../build/create-dmg/create-dmg \
--no-internet-enable \
--volname "Omniview Nightly" \
--text-size 12 \
--window-pos 400 400 \
--window-size 660 450 \
--icon-size 80 \
--icon "Omniview.app" 180 180 \
--hide-extension "Omniview.app" \
--app-drop-link 480 180 \
"../bin/Omniview_${VERSION}_darwin_universal.dmg" \
"../bin"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nightly-macos-dmg
path: bin/Omniview_${{ needs.check-changes.outputs.nightly_version }}_darwin_universal.dmg
if-no-files-found: error
retention-days: 1
# ─────────────────────────────────────────────────────────────────────────────
# Linux (linux/amd64)
# ─────────────────────────────────────────────────────────────────────────────
build-linux:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.should_build == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Linux dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libgtk-3-dev libwebkit2gtk-4.1-dev libwayland-dev build-essential pkg-config
version: 1.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: |
- args: []
- args: [--global, typescript]
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: "go.sum"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Wails v3
run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest
- name: Build frontend
run: task common:build:frontend
- name: Build Omniview
run: |
go build -tags "production,webkit2_41" -trimpath -buildvcs=false \
-ldflags "-w -s \
-X github.com/omniviewdev/omniview/internal/version.Version=${{ needs.check-changes.outputs.nightly_version }} \
-X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \
-X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
-X github.com/omniviewdev/omniview/internal/version.Development=true \
-X github.com/omniviewdev/omniview/internal/telemetry.buildOTLPEndpoint=${{ secrets.TELEMETRY_OTLP_ENDPOINT }} \
-X github.com/omniviewdev/omniview/internal/telemetry.buildPyroscopeEndpoint=${{ secrets.TELEMETRY_PYROSCOPE_ENDPOINT }}" \
-o bin/Omniview .
- name: Rename executable
working-directory: ./bin
run: mv Omniview "Omniview_${{ needs.check-changes.outputs.nightly_version }}_linux_amd64"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nightly-linux-binary
path: bin/Omniview_${{ needs.check-changes.outputs.nightly_version }}_linux_amd64
if-no-files-found: error
retention-days: 1
# ─────────────────────────────────────────────────────────────────────────────
# Windows (windows/amd64)
# ─────────────────────────────────────────────────────────────────────────────
build-windows:
runs-on: windows-latest
needs: check-changes
if: needs.check-changes.outputs.should_build == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: |
- args: []
- args: [--global, typescript]
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: "go.sum"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Wails v3
shell: bash
run: go install github.com/wailsapp/wails/v3/cmd/wails3@latest
- name: Build frontend
shell: bash
run: task common:build:frontend
- name: Build Omniview
shell: bash
run: |
go build -tags production -trimpath -buildvcs=false \
-ldflags "-w -s -H windowsgui \
-X github.com/omniviewdev/omniview/internal/version.Version=${{ needs.check-changes.outputs.nightly_version }} \
-X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \
-X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
-X github.com/omniviewdev/omniview/internal/version.Development=true \
-X github.com/omniviewdev/omniview/internal/telemetry.buildOTLPEndpoint=${{ secrets.TELEMETRY_OTLP_ENDPOINT }} \
-X github.com/omniviewdev/omniview/internal/telemetry.buildPyroscopeEndpoint=${{ secrets.TELEMETRY_PYROSCOPE_ENDPOINT }}" \
-o bin/Omniview.exe .
- name: Rename executable
working-directory: ./bin
run: Rename-Item -Path "Omniview.exe" -NewName "Omniview_${{ needs.check-changes.outputs.nightly_version }}_windows_amd64.exe"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nightly-windows-binary
path: bin/Omniview_${{ needs.check-changes.outputs.nightly_version }}_windows_amd64.exe
if-no-files-found: error
retention-days: 1
# ─────────────────────────────────────────────────────────────────────────────
# NPM — publish @omniviewdev/* nightly packages
# ─────────────────────────────────────────────────────────────────────────────
publish-npm:
needs: check-changes
if: needs.check-changes.outputs.should_build == 'true'
uses: ./.github/workflows/npm-publish.yml
with:
version: ${{ needs.check-changes.outputs.nightly_version }}
dist-tag: nightly
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# ─────────────────────────────────────────────────────────────────────────────
# Publish nightly — rolling tag
# ─────────────────────────────────────────────────────────────────────────────
publish-nightly:
runs-on: ubuntu-latest
needs: [check-changes, build-macos, build-linux, build-windows]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect release assets
shell: bash
run: |
mkdir -p release
cp artifacts/nightly-macos-dmg/*.dmg release/
cp artifacts/nightly-linux-binary/* release/
cp artifacts/nightly-windows-binary/*.exe release/
- name: Generate checksums
shell: bash
working-directory: release
run: sha256sum * > checksums_sha256.txt
- name: Delete previous nightly release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete nightly --yes --cleanup-tag 2>/dev/null || true
- name: Create nightly release
uses: softprops/action-gh-release@v2
with:
tag_name: nightly
name: "Nightly Build (${{ needs.check-changes.outputs.nightly_version }})"
body: |
Automated nightly build from `main` branch.
**Version**: `${{ needs.check-changes.outputs.nightly_version }}`
**Commit**: ${{ github.sha }}
> These builds are for testing purposes and may be unstable.
>
> Install via Homebrew: `brew install --cask omniviewdev/tap/omniview-nightly`
files: release/*
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update Homebrew Nightly Cask
shell: bash
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ -z "$HOMEBREW_TAP_TOKEN" ]; then
echo "::warning::HOMEBREW_TAP_TOKEN not set, skipping Homebrew nightly update"
exit 0
fi
VERSION="${{ needs.check-changes.outputs.nightly_version }}"
DMG_FILE="release/Omniview_${VERSION}_darwin_universal.dmg"
SHA256=$(sha256sum "$DMG_FILE" | awk '{print $1}')
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/omniviewdev/homebrew-tap.git" tap
cd tap
sed -i "s/version \".*\"/version \"${VERSION}\"/" Casks/omniview-nightly.rb
sed -i "s/sha256 \".*\"/sha256 \"${SHA256}\"/" Casks/omniview-nightly.rb
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/omniview-nightly.rb
git diff --cached --quiet && echo "No changes to commit" && exit 0
git commit -m "Update omniview-nightly to ${VERSION}"
git push