-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·446 lines (369 loc) · 18.8 KB
/
main.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
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
435
436
437
438
439
440
441
442
443
444
445
446
name: main
on:
release:
types: [published]
env:
VERSION: ${GITHUB_REF##*/}
PLAIN_VERSION: ${GITHUB_REF##*/v}
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
APP_EMAIL: ${{ secrets.APP_EMAIL }}
APPLICATION_CERTIFICATE_BASE64: ${{ secrets.APPLICATION_CERTIFICATE_BASE64 }}
jobs:
gdrive-upload:
name: Upload all exports to Google Drive
needs: [windows-export, linux-export, macos-export, macos-arm64-export]
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Setup env
run: |
echo "TAG=${{env.VERSION}}" >> "$GITHUB_ENV"
mv hardwario-code-windows/* .
mv hardwario-code-linux/* .
mv hardwario-code-macos-x86_64/* .
mv hardwario-code-macos-arm64/* .
- name: Upload to gdrive Windows
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.credentials }}
filename: "hio-code-${{env.TAG}}-windows.msi"
folderId: ${{ secrets.folderId }}
- name: Upload to gdrive Linux tar
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.credentials }}
filename: "hio-code-${{env.TAG}}-linux.tar.gz"
folderId: ${{ secrets.folderId }}
- name: Upload to gdrive macOS x86_64
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.credentials }}
filename: "hio-code-${{env.TAG}}-macos-x86_64.pkg"
folderId: ${{ secrets.folderId }}
- name: Upload to gdrive macOS Apple Silicon
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.credentials }}
filename: "hio-code-${{env.TAG}}-macos-arm64.pkg"
folderId: ${{ secrets.folderId }}
windows-export:
name: Export HARDWARIO Code Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: caphyon/advinst-github-action@v1.0
with:
advinst-version: '19.7'
advinst-enable-automation: 'true'
- name: Download and unzip Visual Studio Code
run: |
curl -o Windows/hardwario-code-windows.zip --ssl-no-revoke -LO "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-archive"
7z x Windows/hardwario-code-windows.zip -ohardwario-code/ -r
- name: Create data folder
run: |
export SYSTEM=Windows
./createDataFolder.sh
mv Windows/data hardwario-code/
shell: bash
- name: Install all extensions
shell: cmd
run: |
call hardwario-code/bin/code.cmd --install-extension cschlosser.doxdocgen
call hardwario-code/bin/code.cmd --install-extension marus25.cortex-debug
call hardwario-code/bin/code.cmd --install-extension ms-vscode.cpptools
call hardwario-code/bin/code.cmd --install-extension ms-vscode.cpptools-themes
call hardwario-code/bin/code.cmd --install-extension twxs.cmake
call hardwario-code/bin/code.cmd --install-extension HARDWARIO.hardwario-tower
del hardwario-code\data\extensions\.init-default-profile-extensions
del hardwario-code\data\extensions\extensions.json
- name: Setup env
shell: bash
run: |
echo "TAG=${{env.VERSION}}" >> "$GITHUB_ENV"
echo "INSTALLER_TAG=${{env.PLAIN_VERSION}}" >> "$GITHUB_ENV"
- name: Rename executable
shell: bash
run: mv hardwario-code/*.exe hardwario-code/HARDWARIO\ Code.exe
- name: Create installer
shell: PowerShell
run: |
$advinst = New-Object -ComObject AdvancedInstaller
$project = $advinst.CreateProjectS("freeware")
$project.ProductDetails.Name = "HARDWARIO Code"
$project.ProductDetails.Publisher = "HARDWARIO a.s."
$project.ProductDetails.Version = "${{env.INSTALLER_TAG}}"
$project.ProductDetails
$project.FilesComponent.AddFolderContentS("appdir", "${{ github.workspace }}\hardwario-code")
$project.InstallParameters.ApplicationFolder = "[LocalAppDataFolder]\Programs\[ProductName]"
$project.ProductDetails.SetIcon("${{ github.workspace }}\media\hardwario-code-icon.ico")
$project.ShortcutsComponent.CreateFileShortcutS("desktopfolder", "appdir\HARDWARIO Code.exe")
$project.ShortcutsComponent.CreateFileShortcutS($project.PredefinedFolders.ShortcutFolder.FullPath, "appdir\HARDWARIO Code.exe")
$project.ShortcutsComponent.Shortcuts[0].Icon("${{ github.workspace }}\media\hardwario-code-icon.ico")
$project.ShortcutsComponent.Shortcuts[1].Icon("${{ github.workspace }}\media\hardwario-code-icon.ico")
$outputFolder = "${{ github.workspace }}\setup";
$defaultBuild = $project.BuildComponent.Builds[0];
$defaultBuild.OutputFolder = $outputFolder
$project.SaveAs("${{ github.workspace }}\hardwario-code.aip")
$project.Build()
- name: Change the msi name
run: mv setup/*.msi hio-code-${{env.TAG}}-windows.msi
- name: Publish the extension;
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: hio-code-${{env.TAG}}-windows.msi
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: hardwario-code-windows
path: hio-code-${{env.TAG}}-windows.msi
linux-export:
name: Export HARDWARIO Code Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Download and unzip Visual Studio Code
run: |
curl -o Linux/hardwario-code-linux.tar.gz --ssl-no-revoke -LO "https://code.visualstudio.com/sha/download?build=stable&os=linux-x64"
tar -xvzf Linux/hardwario-code-linux.tar.gz
mv VSCode-linux-x64 hardwario-code
- name: Create data folder
run: |
export SYSTEM=Linux
chmod +x createDataFolder.sh
./createDataFolder.sh
mv Linux/data hardwario-code/
- name: Set permissions and icon
run: |
chmod o+rwx hardwario-code
chmod +rwx hardwario-code/code
chmod 777 -R hardwario-code/data
cp media/hardwario-code-icon.png hardwario-code/
cp media/hardwario-code.desktop hardwario-code/
cp media/install.sh hardwario-code/
chmod +x hardwario-code/install.sh
- name: Install all extensions
run: |
./hardwario-code/bin/code --install-extension cschlosser.doxdocgen
./hardwario-code/bin/code --install-extension marus25.cortex-debug
./hardwario-code/bin/code --install-extension ms-vscode.cpptools
./hardwario-code/bin/code --install-extension ms-vscode.cpptools-themes
./hardwario-code/bin/code --install-extension twxs.cmake
./hardwario-code/bin/code --install-extension HARDWARIO.hardwario-tower
rm -rf ./hardwario-code/data/extensions/.init-default-profile-extensions
rm -rf ./hardwario-code/data/extensions/extensions.json
- name: Setup env
run: |
echo "TAG=${{env.VERSION}}" >> "$GITHUB_ENV"
echo "PLAIN_TAG=${{env.PLAIN_VERSION}}" >> "$GITHUB_ENV"
- name: Zip the final product
run: tar -czvf hio-code-${{env.TAG}}-linux.tar.gz hardwario-code/
- name: Publish the extension
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: |
hio-code-${{env.TAG}}-linux.tar.gz
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: hardwario-code-linux
path: hio-code-${{env.TAG}}-linux.tar.gz
macos-export:
name: Export HARDWARIO Code macOS x86_64
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Download and unzip Visual Studio Code
run: |
mkdir hardwario-code
curl -o macOS/hardwario-code-macos.zip --ssl-no-revoke -LO "https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal"
unzip macOS/hardwario-code-macos.zip
- name: Create data folder
run: |
chmod +x createDataFolder.sh
export SYSTEM=macOS
./createDataFolder.sh
mv macOS/code-portable-data hardwario-code/
- name: Setup the final folder
run: |
xattr -dr com.apple.quarantine Visual\ Studio\ Code.app
mv Visual\ Studio\ Code.app hardwario-code/Visual\ Studio\ Code.app
chmod -R 777 hardwario-code/
- name: Install all extensions
run: |
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension cschlosser.doxdocgen
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension marus25.cortex-debug
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension ms-vscode.cpptools
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension ms-vscode.cpptools-themes
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension twxs.cmake
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension HARDWARIO.hardwario-tower
rm -rf hardwario-code/code-portable-data/.init-default-profile-extensions
rm -rf hardwario-code/code-portable-data/extensions.json
- name: Prepare macOS Installer
run: |
git clone https://github.com/SmejkalJakub/hardwario-macos-installer.git
mv hardwario-code/Visual\ Studio\ Code.app hardwario-macos-installer/macOS-x64/application/Visual\ Studio\ Code.app
mv hardwario-code/code-portable-data hardwario-macos-installer/macOS-x64/application/code-portable-data
- name: Setup env
run: echo "TAG=${{env.VERSION}}" >> "$GITHUB_ENV"
- name: Install the Apple certificate and provisioning profile
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Codesign every component
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
run: |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo $APPLICATION_CERTIFICATE_BASE64 | base64 --decode > application.p12
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security import application.p12 -k $KEYCHAIN_PATH -P $P12_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security find-identity -v
security find-identity -p codesigning
bash sign.sh
- name: Run macOS Installer
run: |
bash hardwario-macos-installer/macOS-x64/build-macos-x64.sh hardwario-code ${{env.TAG}}
mv hardwario-macos-installer/macOS-x64/target/pkg-signed/hardwario-code-macos-${{env.TAG}}.pkg "${{ github.workspace }}/hio-code-${{env.TAG}}-macos-x86_64.pkg"
xcrun notarytool submit "${{ github.workspace }}/hio-code-${{env.TAG}}-macos-x86_64.pkg" --apple-id "$APP_EMAIL" --password "$APP_SPECIFIC_PASSWORD" --team-id "C32QFQ68V9"
- name: Publish the extension
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: hio-code-${{env.TAG}}-macos-x86_64.pkg
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: hardwario-code-macos-x86_64
path: hio-code-${{env.TAG}}-macos-x86_64.pkg
macos-arm64-export:
name: Export HARDWARIO Code macOS arm64
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: robinraju/release-downloader@v1.7
with:
repository: "microsoft/vscode-cpptools"
latest: true
fileName: "cpptools-osx-arm64.vsix"
- name: Download and unzip Visual Studio Code
run: |
mkdir hardwario-code
curl -o macOS/hardwario-code-macos.zip --ssl-no-revoke -LO "https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal"
unzip macOS/hardwario-code-macos.zip
- name: Create data folder
run: |
chmod +x createDataFolder.sh
export SYSTEM=macOS-arm64
./createDataFolder.sh
mv macOS-arm64/code-portable-data hardwario-code/
- name: Setup the final folder
run: |
xattr -dr com.apple.quarantine Visual\ Studio\ Code.app
mv Visual\ Studio\ Code.app hardwario-code/Visual\ Studio\ Code.app
chmod -R 777 hardwario-code/
- name: Install all extensions
run: |
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension cschlosser.doxdocgen
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension marus25.cortex-debug
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension cpptools-osx-arm64.vsix
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension ms-vscode.cpptools-themes
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension twxs.cmake
./hardwario-code/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --install-extension HARDWARIO.hardwario-tower
rm -rf hardwario-code/code-portable-data/.init-default-profile-extensions
rm -rf hardwario-code/code-portable-data/extensions.json
- name: Prepare macOS Installer
run: |
git clone https://github.com/SmejkalJakub/hardwario-macos-installer.git
mv hardwario-code/Visual\ Studio\ Code.app hardwario-macos-installer/macOS-x64/application/Visual\ Studio\ Code.app
mv hardwario-code/code-portable-data hardwario-macos-installer/macOS-x64/application/code-portable-data
- name: Setup env
run: echo "TAG=${{env.VERSION}}" >> "$GITHUB_ENV"
- name: Install the Apple certificate and provisioning profile
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Codesign every component
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
run: |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo $APPLICATION_CERTIFICATE_BASE64 | base64 --decode > application.p12
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security import application.p12 -k $KEYCHAIN_PATH -P $P12_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security find-identity -v
security find-identity -p codesigning
bash sign.sh
- name: Run macOS Installer
run: |
bash hardwario-macos-installer/macOS-x64/build-macos-x64.sh hardwario-code ${{env.TAG}}
mv hardwario-macos-installer/macOS-x64/target/pkg-signed/hardwario-code-macos-${{env.TAG}}.pkg "${{ github.workspace }}/hio-code-${{env.TAG}}-macos-arm64.pkg"
xcrun notarytool submit "${{ github.workspace }}/hio-code-${{env.TAG}}-macos-arm64.pkg" --apple-id "$APP_EMAIL" --password "$APP_SPECIFIC_PASSWORD" --team-id "C32QFQ68V9"
- name: Publish the extension
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: hio-code-${{env.TAG}}-macos-arm64.pkg
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: hardwario-code-macos-arm64
path: hio-code-${{env.TAG}}-macos-arm64.pkg