generated from electron-react-boilerplate/electron-react-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 15
350 lines (307 loc) · 12.6 KB
/
publish.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
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
name: Publish
on:
push:
branches:
- main
- next
workflow_dispatch:
branches:
- main
- next
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
packages: write
actions: write
issues: write
pull-requests: write
jobs:
tag:
outputs:
kit_tag: ${{ steps.set_kit_tag.outputs.result }}
runs-on: ubuntu-latest
steps:
- name: Echo all available variables
run: |
echo "All available variables:"
echo "-------------------------"
echo "GITHUB_SHA: ${{ github.sha }}"
echo "GITHUB_REF: ${{ github.ref }}"
echo "GITHUB_WORKFLOW: ${{ github.workflow }}"
echo "GITHUB_ACTION: ${{ github.action }}"
echo "GITHUB_ACTOR: ${{ github.actor }}"
echo "GITHUB_REPOSITORY: ${{ github.repository }}"
echo "GITHUB_EVENT_NAME: ${{ github.event_name }}"
echo "GITHUB_WORKSPACE: ${{ github.workspace }}"
echo "GITHUB_HEAD_REF: ${{ github.head_ref }}"
echo "GITHUB_BASE_REF: ${{ github.base_ref }}"
echo "GITHUB_SERVER_URL: ${{ github.server_url }}"
echo "GITHUB_API_URL: ${{ github.api_url }}"
echo "GITHUB_GRAPHQL_URL: ${{ github.graphql_url }}"
echo "RUNNER_OS: ${{ runner.os }}"
echo "RUNNER_TEMP: ${{ runner.temp }}"
echo "RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}"
# kit-action will automatically actions/checkout and actions/setup-node
- name: Set kit_tag
id: set_kit_tag
uses: johnlindquist/kit-action@main
with:
script: set-kit-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug - Echo kit_tag
run: |
echo "kit_tag from step output: ${{ steps.set_kit_tag.outputs.result }}"
- name: Debug - List all step outputs
run: |
echo "All step outputs:"
echo "${{ toJson(steps) }}"
semantic:
outputs:
release_id: ${{ steps.create_release.outputs.result }}
semantic_version: ${{ steps.semantic.outputs.new_release_version }}
needs: tag
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Debug - Echo kit_tag from previous job
run: |
echo "kit_tag from needs.tag.outputs: ${{ needs.tag.outputs.kit_tag }}"
- name: Debug - List all job outputs
run: |
echo "All job outputs:"
echo "${{ toJson(needs) }}"
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic # Need an `id` for output variables
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo kit-action version
run: |
echo "Using johnlindquist/kit-action@${{ needs.tag.outputs.kit_tag }}"
echo "Release Channel: ${{ steps.semantic.outputs.new_release_channel }}"
echo "Previous Release Channel: ${{ steps.semantic.outputs.last_release_version }}"
echo "Semantic Version: ${{ steps.semantic.outputs.new_release_version }}"
- name: Create Release
id: create_release
uses: johnlindquist/kit-action@main
with:
script: create-release ${{ steps.semantic.outputs.new_release_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [tag, semantic]
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [script-kit-windows-latest-arm64, script-kit-ubuntu-latest-arm64, windows-latest, ubuntu-latest]
os: [windows-2022, script-kit-ubuntu-latest-arm64, windows-latest, ubuntu-latest, macos-latest, macos-14]
steps:
- name: Debug - Echo kit_tag from previous jobs
run: |
echo "kit_tag from needs.tag.outputs: ${{ needs.tag.outputs.kit_tag }}"
# We're essentially treating the runners ending in "latest" as x64, and the others as arm64. Dumb fix, but it works for now.
- name: Determine arch from runner name
id: determine_arch
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" || "${{ matrix.os }}" == "ubuntu-latest" || "${{ matrix.os }}" == "macos-latest" ]]; then
echo "arch=x64" >> $GITHUB_OUTPUT
else
echo "arch=arm64" >> $GITHUB_OUTPUT
fi
- name: Debug - List all job outputs
run: |
echo "All job outputs:"
echo "${{ toJson(needs) }}"
- name: Checkout git repo
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3
- name: Install Node, pnpm and Yarn
uses: actions/setup-node@v4
with:
node-version: 20.18.0
- name: Write the Semantic Version to package.json version property for main
if: needs.tag.outputs.kit_tag == 'latest'
uses: johnlindquist/kit-action@main
with:
script: update-package-version ${{ needs.semantic.outputs.semantic_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Nix - Write the current branch to a releaseChannel env var
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'script-kit-ubuntu-latest-arm64' }}
run: |
echo "RELEASE_CHANNEL=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Windows - Write the current branch to a releaseChannel env var
if: ${{ matrix.os == 'windows-latest' || matrix.os == 'windows-2022' }}
run: |
echo "RELEASE_CHANNEL=$(git rev-parse --abbrev-ref HEAD)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download kenv main
if: needs.tag.outputs.kit_tag == 'latest'
uses: johnlindquist/kit-action@main
with:
script: download-kenv ${{ env.RELEASE_CHANNEL }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Assets main
if: needs.tag.outputs.kit_tag == 'latest'
uses: johnlindquist/kit-action@main
with:
script: create-assets ${{ needs.semantic.outputs.semantic_version}} ${{ matrix.os }} ${{ steps.determine_arch.outputs.arch }} ${{ needs.semantic.outputs.release_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Optional Dependencies Based on Platform and Architecture
if: needs.tag.outputs.kit_tag == 'latest'
uses: johnlindquist/kit-action@main
with:
script: set-optional-dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish windows x64
if: matrix.os == 'windows-latest'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILD_ARCH: x64
ELECTRON_BUILD_PLATFORM: win32
run: |
pnpm i
cat ./package.json
pnpm vite-prebuild
pnpm exec kit ./build.ts win x64 always
- name: Publish windows arm64
if: matrix.os == 'windows-2022'
run: |
pnpm i
pnpm exec kit remove-tick
pnpm vite-prebuild
pnpm exec kit ./build.ts win arm64 always
env:
# These values are used for auto updates signing
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILD_ARCH: arm64
ELECTRON_BUILD_PLATFORM: win32
- name: Install GCC 10 and native-keymap dependencies
if: matrix.os == 'ubuntu-latest' || matrix.os == 'script-kit-ubuntu-latest-arm64'
run: |
sudo apt-get update
sudo apt-get install -y libxtst-dev
sudo apt-get install -y make gcc libpng++-dev
sudo apt-get install -y g++-10
sudo apt-get install -y libx11-dev libxkbfile-dev
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
sudo update-alternatives --set g++ /usr/bin/g++-10
echo "CXX=g++-10" >> $GITHUB_ENV
- name: Publish linux x64
if: matrix.os == 'ubuntu-latest'
env:
# These values are used for auto updates signing
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILD_ARCH: x64
ELECTRON_BUILD_PLATFORM: linux
run: |
node --version
pnpm --version
pnpm i
cat ./package.json
pnpm vite-prebuild
pnpm exec kit ./build.ts linux x64 always
- name: Publish linux arm64
if: matrix.os == 'script-kit-ubuntu-latest-arm64'
env:
# These values are used for auto updates signing
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILD_ARCH: arm64
ELECTRON_BUILD_PLATFORM: linux
run: |
sudo apt-get install ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm
export USE_SYSTEM_FPM=true
node --version
pnpm --version
pnpm i
pnpm exec kit remove-tick
cat ./package.json
pnpm vite-prebuild
which npm
pnpm --version
pnpm exec kit ./build.ts linux arm64 always
- name: Publish mac x64
if: matrix.os == 'macos-latest'
env:
# These values are used for auto updates signing
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILD_ARCH: x64
ELECTRON_BUILD_PLATFORM: darwin
# Wait 3 minutes to start to avoid signing issues
run: |
sleep 180
pnpm i
pnpm vite-prebuild
pnpm exec kit ./build.ts mac ${{ steps.determine_arch.outputs.arch }} always
- name: Publish mac arm64
if: matrix.os == 'macos-14'
env:
# These values are used for auto updates signing
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILD_ARCH: arm64
ELECTRON_BUILD_PLATFORM: darwin
run: |
pnpm i
pnpm vite-prebuild
pnpm exec kit ./build.ts mac ${{ steps.determine_arch.outputs.arch }} always
- name: Merge latest-mac.yml and latest-mac-arm64.yml
if: contains(matrix.os, 'macos')
# Just something to keep an eye on in case kit-action changes.
uses: johnlindquist/kit-action@main
with:
script: merge-mac-latest-yml script-kit kitapp ${{ steps.determine_arch.outputs.arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}