-
Notifications
You must be signed in to change notification settings - Fork 68
214 lines (207 loc) · 8.15 KB
/
build.yml
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
name: Build & Release
on:
push:
branches:
- master
tags:
- v*
pull_request:
workflow_dispatch:
permissions:
# https://github.com/softprops/action-gh-release/issues/236
contents: write
jobs:
build:
name: Build (${{ matrix.os }}) - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
arch: [amd64, arm64]
exclude:
# Cross-compilation to arm64 on x86 Linux is broken due to a bug in Go/Wails.
# Until that is fixed, only build x86 Linux binaries.
- os: ubuntu-latest
arch: arm64
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: go version
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: frontend/package.json
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- run: node --version
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Set up Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
# -----
# Linux
# -----
- name: Install Linux Wails Dependencies
if: runner.os == 'Linux'
run: task build:deps
- name: Build Linux Binary
if: runner.os == 'Linux'
run: task build:prod ARCH=${{ matrix.arch }}
- name: Archive Linux Binary
if: runner.os == 'Linux'
run: tar -czvf Zen_linux_${{ matrix.arch }}.tar.gz -C build/bin Zen
- name: Build Linux Binary With Self-Updates Disabled
if: runner.os == 'Linux'
run: task build:prod-noupdate ARCH=${{ matrix.arch }}
- name: Archive Linux Binary With Self-Updates Disabled
if: runner.os == 'Linux'
run: tar -czvf Zen_linux_${{ matrix.arch }}_noselfupdate.tar.gz -C build/bin Zen
- name: Upload Linux Binary Artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Zen_linux_${{ matrix.arch }}
path: Zen_linux_${{ matrix.arch }}.tar.gz
- name: Upload Linux Binary With Self-Updates Disabled Artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Zen_linux_${{ matrix.arch }}_noselfupdate
path: Zen_linux_${{ matrix.arch }}_noselfupdate.tar.gz
- name: Release Linux Binary Artifact
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: Zen_linux_${{ matrix.arch }}.tar.gz
tag_name: ${{ github.ref }}
draft: true
- name: Release Linux Binary With Self-Updates Disabled Artifact
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: Zen_linux_${{ matrix.arch }}_noselfupdate.tar.gz
tag_name: ${{ github.ref }}
draft: true
# -----
# macOS
# -----
- name: Install required macOS dependencies
if: runner.os == 'macOS'
run: task build:deps
- name: Set up keychain profile
if: runner.os == 'macOS'
env:
CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
run: |
CI_KEYCHAIN_PWD=$CI_KEYCHAIN_PWD \
CERTIFICATE=$CERTIFICATE \
CERTIFICATE_PWD=$CERTIFICATE_PWD \
task build:setup-keychain
- name: Build macOS App & Installer
if: runner.os == 'macOS'
env:
CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
run: |
CERTIFICATE_NAME=$CERTIFICATE_NAME \
NOTARIZATION_APPLE_ID=$NOTARIZATION_APPLE_ID \
NOTARIZATION_TEAM_ID=$NOTARIZATION_TEAM_ID \
NOTARIZATION_PWD=$NOTARIZATION_PWD \
task build:prod ARCH=${{ matrix.arch }}
- name: Rename macOS installer
if: runner.os == 'macOS'
run: mv build/bin/Zen.dmg build/bin/Zen-${{ matrix.arch }}.dmg
- name: Upload macOS installer artifact
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: Zen_darwin_${{ matrix.arch }}_installer
path: build/bin/Zen-${{ matrix.arch }}.dmg
- name: Release macOS Installer
if: runner.os == 'macOS' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: build/bin/Zen-${{ matrix.arch }}.dmg
tag_name: ${{ github.ref }}
draft: true
- name: Archive macOS App Bundle
if: runner.os == 'macOS'
run: tar -czvf Zen_darwin_${{ matrix.arch }}.tar.gz -C build/bin Zen.app
- name: Upload Archived macOS App Bundle Artifact
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: Zen_darwin_${{ matrix.arch }}_app
path: Zen_darwin_${{ matrix.arch }}.tar.gz
- name: Release Archived macOS App Bundle
if: runner.os == 'macOS' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: Zen_darwin_${{ matrix.arch }}.tar.gz
tag_name: ${{ github.ref }}
draft: true
# -------
# Windows
# -------
- name: Build Windows App & Installer
if: runner.os == 'Windows'
run: task build:prod ARCH=${{ matrix.arch }}
- name: Archive Windows Binary
if: runner.os == 'Windows'
run: Compress-Archive -Path .\build\bin\Zen.exe -DestinationPath Zen_windows_${{ matrix.arch }}.zip
- name: Upload Archived Windows Binary Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Zen_windows_${{ matrix.arch }}
path: Zen_windows_${{ matrix.arch }}.zip
- name: Upload Windows Installer Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Zen_windows_${{ matrix.arch }}_installer
path: build/bin/Zen-${{ matrix.arch }}-installer.exe
- name: Release Archived Windows Binary
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: Zen_windows_${{ matrix.arch }}.zip
tag_name: ${{ github.ref }}
draft: true
- name: Release Windows Installer
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: build/bin/Zen-${{ matrix.arch }}-installer.exe
tag_name: ${{ github.ref }}
draft: true
- name: Build Windows Binary With Self-Updates Disabled
if: runner.os == 'Windows'
run: task build:prod-noupdate ARCH=${{ matrix.arch }}
- name: Archive Windows Binary With Self-Updates Disabled
if: runner.os == 'Windows'
run: Compress-Archive -Path .\build\bin\Zen.exe -DestinationPath Zen_windows_${{ matrix.arch }}_noselfupdate.zip
- name: Upload Archived Windows Binary With Self-Updates Disabled Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Zen_windows_${{ matrix.arch }}_noselfupdate
path: Zen_windows_${{ matrix.arch }}_noselfupdate.zip
- name: Release Archived Windows Binary With Self-Updates Disabled
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: Zen_windows_${{ matrix.arch }}_noselfupdate.zip
tag_name: ${{ github.ref }}
draft: true