-
Notifications
You must be signed in to change notification settings - Fork 4
229 lines (207 loc) · 7.06 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: Build and Release
run-name: Build ${{ github.run_number }} of branch ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_dispatch:
jobs:
# -----------------------------------------------------------------
# PREPARE
# -----------------------------------------------------------------
prepare:
name: Prepare Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
outputs:
pkg_version: ${{ steps.semver.outputs.nextStrict }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: main
skipInvalidTags: true
- name: Create Draft Release
uses: ncipollo/[email protected]
with:
prerelease: true
draft: false
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.nextStrict }}
name: ${{ steps.semver.outputs.nextStrict }}
body: '*pending*'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate CHANGELOG
id: changelog
uses: Requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.semver.outputs.nextStrict }}
toTag: ${{ steps.semver.outputs.current }}
writeToFile: false
- name: Update Release Body
uses: ncipollo/[email protected]
with:
prerelease: true
updateOnlyUnreleased: true
allowUpdates: true
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.nextStrict }}
name: ${{ steps.semver.outputs.nextStrict }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}
# -----------------------------------------------------------------
# BUILD ELECTRON
# -----------------------------------------------------------------
build-electron:
name: Build Electron
needs: [prepare]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x64
ext: tar.gz
- os: ubuntu-latest
platform: linux
arch: arm64
ext: tar.gz
- os: macos-latest
platform: darwin
arch: x64
ext: dmg
- os: macos-latest
platform: darwin
arch: arm64
ext: dmg
- os: windows-latest
platform: win32
arch: x64
ext: exe
- os: windows-latest
platform: win32
arch: arm64
ext: exe
env:
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Fetch Secrets from Vault
if: ${{ matrix.platform == 'darwin' }}
uses: hashicorp/[email protected]
with:
method: jwt
url: ${{ secrets.VAULT_URL }}
role: ${{ secrets.VAULT_ROLE }}
secrets: |
kv/data/draftforge/apple API_ISSUER_ID | APPLE_API_ISSUER ;
kv/data/draftforge/apple API_KEY_ID | APPLE_API_KEY_ID ;
kv/data/draftforge/apple API_KEY_P8 | API_KEY_P8 ;
kv/data/draftforge/apple DIST_CERT_P12 | CSC_LINK ;
kv/data/draftforge/apple DIST_CERT_P12_PWD | CSC_KEY_PASSWORD ;
- name: Save signing certs
if: ${{ matrix.platform == 'darwin' }}
run: |
mkdir -p private_keys
echo "APPLE_API_KEY=private_keys/AuthKeys_$APPLE_API_KEY_ID.p8" >> "$GITHUB_ENV"
# echo "CSC_LINK=private_keys/distribution.p12" >> "$GITHUB_ENV"
openssl base64 -d <<< "$API_KEY_P8" -out "private_keys/AuthKeys_$APPLE_API_KEY_ID.p8"
# openssl base64 -d <<< "$DIST_CERT_P12" -out "private_keys/distribution.p12"
- name: Import Certs into keychain
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ env.DIST_CERT_P12 }}
p12-password: ${{ env.DIST_CERT_P12_PWD }}
- name: Set Version
run: |
node -e "const fs = require('node:fs'); const pkg = require('./package.json'); pkg.version = '${{ env.PKG_VERSION }}'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
- name: Build package
env:
DEBUG: "electron-notarize*"
run: |
echo "Installing dependencies..."
npm ci
echo "Build package..."
npx quasar build -m electron -T ${{ matrix.platform }} --arch ${{ matrix.arch }} -P never
- name: Upload Build Artifact
id: artifactupload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-${{ matrix.arch }}-build
path: "dist/electron/Packaged/*.${{ matrix.ext }}"
- id: signpath
if: ${{ matrix.platform == 'win32' && matrix.arch == 'x64' }}
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ secrets.SIGNPATH_ORG_ID }}'
project-slug: 'editor'
signing-policy-slug: 'test-signing'
github-artifact-id: '${{ steps.artifactupload.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: signed-build
- name: Add Signed Package to Release
if: ${{ matrix.platform == 'win32' && matrix.arch == 'x64' }}
uses: ncipollo/[email protected]
with:
prerelease: true
updateOnlyUnreleased: true
allowUpdates: true
omitBody: true
tag: ${{ env.PKG_VERSION }}
name: ${{ env.PKG_VERSION }}
artifacts: "signed-build/*.${{ matrix.ext }}"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Add Package to Release
if: ${{ !(matrix.platform == 'win32' && matrix.arch == 'x64') }}
uses: ncipollo/[email protected]
with:
prerelease: true
updateOnlyUnreleased: true
allowUpdates: true
omitBody: true
tag: ${{ env.PKG_VERSION }}
name: ${{ env.PKG_VERSION }}
artifacts: "dist/electron/Packaged/*.${{ matrix.ext }}"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Purge signing certs
if: ${{ matrix.platform == 'darwin' && always() }}
run: |
rm -rf private_keys
# -----------------------------------------------------------------
# RELEASE
# -----------------------------------------------------------------
release:
name: Publish Release
needs: [prepare, build-electron]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
env:
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}
steps:
- name: Finalize Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
makeLatest: true
prerelease: false
omitBody: true
draft: false
tag: ${{ env.PKG_VERSION }}
name: ${{ env.PKG_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}