-
-
Notifications
You must be signed in to change notification settings - Fork 10
267 lines (229 loc) · 10.6 KB
/
release.yaml
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
name: Release October
on:
pull_request:
branches: [main]
release:
types: [published]
jobs:
release:
strategy:
matrix:
build:
- platform: darwin/amd64
os: macos-latest
tag: darwin_amd64
- platform: darwin/arm64
os: macos-latest
tag: darwin_arm64
- platform: darwin/universal
os: macos-latest
tag: darwin_universal
- arch: amd64
platform: linux/amd64
os: ubuntu-latest
tag: linux_amd64_webkit2gtk40
- arch: amd64
platform: linux/amd64
os: ubuntu-latest
tag: linux_amd64
- arch: arm64
platform: linux/arm64
os: buildjet-4vcpu-ubuntu-2204-arm
tag: linux_arm64_webkit2gtk40
- arch: arm64
platform: linux/arm64
os: buildjet-4vcpu-ubuntu-2204-arm
tag: linux_arm64
- arch: amd64
platform: windows/amd64
os: windows-latest
tag: windows_amd64
- arch: amd64
platform: windows/amd64
os: windows-latest
tag: windows-portable_amd64
runs-on: ${{ matrix.build.os }}
name: Release October (${{ matrix.build.tag }})
steps:
- name: Checkout source code
uses: actions/checkout@v4
# Set up common, sanitised environment variables
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
if [ -n "${{ github.event.release.tag_name }}" ]; then
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
else
version="1.0.0"
fi
echo "version=$version" >> $GITHUB_OUTPUT
# Set up development dependencies
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Install wails
shell: bash
run: go install github.com/wailsapp/wails/v2/cmd/[email protected]
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20.8.0'
# Dependencies
## Linux (webkit2gtk-4.0)
- name: Install Ubuntu prerequisites
if: runner.os == 'Linux' && contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
## Linux (webkit2gtk-4.1)
- name: Install Ubuntu prerequisites
if: runner.os == 'Linux' && !contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
## macOS
- name: Setup Gon
if: runner.os == 'macOS'
run: brew install Bearer/tap/gon
- name: Import code signing certificate from Github Secrets
uses: Apple-Actions/import-codesign-certs@v3
if: runner.os == 'macOS'
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
## Windows
- name: Install Windows dependencies
if: runner.os == 'Windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install nsis
# Build -- frontend
- name: Build frontend assets
shell: bash
run: |
npm install -g npm
node version.js "v${{ steps.normalise_version.outputs.version }}"
cd frontend && npm install
# Build -- app variants
## Linux (webkit2gtk-4.0) -- We explicitly set 4.0 in this tag because it'll only be less used over time
- name: Build wails app for Linux (webkit2gtk-4.0)
if: runner.os == 'Linux' && contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"
## Linux (webkit2gtk-4.1) -- We set this as the new default as more users will use 24.0x+ over time
- name: Build wails app for Linux (webkit2gtk-4.1)
if: runner.os == 'Linux' && !contains(matrix.build.tag, 'webkit2gtk40')
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -tags webkit2_41 -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"
## macOS
- name: Build wails app for macOS
if: runner.os == 'macOS'
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}"
## Windows
- name: Build Windows NSIS installer (Normal)
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64'
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -nsis -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}" -windowsconsole
- name: Build Windows NSIS installer (Portable)
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64'
shell: bash
run: wails build -platform ${{ matrix.build.platform }} -nsis -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.portablebuild=true" -windowsconsole
# Codesigning (only performed when releases are cut)
## macOS
- name: Notarise macOS app + create dmg
if: runner.os == 'macOS' && startsWith(github.ref, 'refs/tags/')
shell: bash
run: gon -log-level=info gon.config.json
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_PROVIDER: "6RNEAKRYDT"
## Windows
- name: Codesign Windows NSIS Installer
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64' && startsWith(github.ref, 'refs/tags/')
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
echo "Signing October installer"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' October-${{ matrix.build.arch }}-installer.exe
working-directory: ./build/bin
- name: Codesign Windows Portable
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64' && startsWith(github.ref, 'refs/tags/')
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
echo "Signing October installer"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' october.exe
working-directory: ./build/bin
# Packaging
## Linux
- name: Package up deb file
if: runner.os == 'Linux'
shell: bash
run: |
mv build/bin/october build/linux/october_0.0.0_ARCH/usr/local/bin/
cd build/linux
sed -i 's/0.0.0/${{ steps.normalise_version.outputs.version }}/g' "october_0.0.0_ARCH/DEBIAN/control"
sed -i 's/ARCH/${{ matrix.build.arch }}/g' "october_0.0.0_ARCH/DEBIAN/control"
mv october_0.0.0_ARCH "october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.arch }}"
dpkg-deb --build "october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.arch }}"
- name: Compress deb
if: runner.os == 'Linux'
shell: bash
run: |
cd build/linux && zip -r october-${{ matrix.build.tag }}.zip october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.arch }}.deb
mv october-${{ matrix.build.tag }}.zip ../bin
## macOS
- name: Compress macOS dmg
if: runner.os == 'macOS' && startsWith(github.ref, 'refs/tags/')
shell: bash
run: cd build/bin && zip -r october-${{ matrix.build.tag }}.zip October.dmg
- name: Compress macOS app
if: ${{ runner.os == 'macOS' && !startsWith(github.ref, 'refs/tags/') }}
shell: bash
run: cd build/bin && zip -r october-${{ matrix.build.tag }}.zip October.app
## Windows
- name: Remove old October binary
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64'
shell: bash
run: rm October.exe
working-directory: ./build/bin
- name: Compress binary (Win Normal)
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64'
run: Compress-Archive October-${{ matrix.build.arch }}-installer.exe october-${{ matrix.build.tag }}.zip
working-directory: ./build/bin
- name: Compress binary (Win Portable)
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64'
run: Compress-Archive october.exe october-${{ matrix.build.tag }}.zip
working-directory: ./build/bin
- name: Upload build artifact
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: october_pr${{ github.event.pull_request.number }}_${{ github.event.pull_request.head.sha }}_${{ matrix.build.tag }}.zip
path: |
./build/bin
- name: Get latest release from API
if: startsWith(github.ref, 'refs/tags/')
id: get_upload_url
shell: bash
run: |
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/marcus-crane/october/releases" > /tmp/releases.json
url=$(jq -r '.[0].upload_url' /tmp/releases.json)
echo "url=$url" >> $GITHUB_OUTPUT
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/')
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_NAME: october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.tag }}
with:
upload_url: ${{ steps.get_upload_url.outputs.url }}
asset_path: ./build/bin/october-${{ matrix.build.tag }}.zip
asset_name: ${{ env.ARTIFACT_NAME }}.zip
asset_content_type: application/zip