forked from chiragsakhuja/lc3tools
-
Notifications
You must be signed in to change notification settings - Fork 6
166 lines (163 loc) · 6.11 KB
/
release.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
name: Release app
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build-linux:
strategy:
matrix:
os:
[
{ name: 'linux', image: 'ubuntu-latest' }
]
runs-on: ${{ matrix.os.image }}
defaults:
run:
working-directory: ./src/gui
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Use Cargo
uses: dtolnay/rust-toolchain@stable
- name: Install Flatpak dependencies
# Needed to build the Flatpak.
#
# Also, during make, electron-forge will install Electron app dependencies, namely:
# - org.freedesktop.Platform
# - org.freedesktop.SDK
# - org.electronjs.Electron2.BaseApp, and
# - https://github.com/refi64/zypak (yes, it pulls a git repo)
#
# I *would* install them here, but the bundler seems to require a specific version
# and doing it here would be *annoying*.
#
# If you wish to change the version of any of those dependencies, do it in forge.config.ts.
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder elfutils
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
git config --global protocol.file.allow always
- name: Install dependencies
run: npm install
- name: Build backend
run: npm run build-backend
- name: Publish app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: DEBUG=@malept/flatpak-bundler* npm run publish
build-win:
strategy:
matrix:
os:
[
{ name: 'windows', image: 'windows-latest' }
]
runs-on: ${{ matrix.os.image }}
defaults:
run:
working-directory: ./src/gui
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Use Cargo
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: npm install
- name: Build backend
run: npm run build-backend
- name: Publish app
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run publish
build-mac:
strategy:
matrix:
os:
[
{ name: 'macos', image: 'macos-latest' },
{ name: 'macos-x86', image: 'macos-13' },
]
runs-on: ${{ matrix.os.image }}
defaults:
run:
working-directory: ./src/gui
steps:
- name: Github checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Use Cargo
uses: dtolnay/rust-toolchain@stable
# https://github.com/electron/forge/issues/3371#issuecomment-2281115374
# setuptools is required to build appdmg (a dependency for creating DMGs).
#
# To install it, we set up a Python environment for both Mac builds and
# install via pip.
- name: Install Python 3.12 (macOS)
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install python-setuptools (macOS)
run: python3 -m pip install setuptools
- name: Install dependencies
run: npm install
- name: Build backend
run: npm run build-backend
- name: Install the Apple certificate and provisioning profile
# https://docs.github.com/en/actions/use-cases-and-examples/deploying/installing-an-apple-certificate-on-macos-runners-for-xcode-development#add-a-step-to-your-workflow
# We're not uploading to MAS, so we do not include BUILD_PROVISION_PROFILE_BASE64.
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
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 -o $CERTIFICATE_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 set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Publish app (macOS)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}
NOTARIZE_EMAIL: ${{ secrets.NOTARIZE_EMAIL }}
NOTARIZE_PASSWORD: ${{ secrets.NOTARIZE_PASSWORD }}
TEAM_ID: ${{ secrets.TEAM_ID }}
# Note to future developers:
# If we ever lose the Apple dev profile,
# we can return to an ad-hoc signature to get the program to work with warnings.
#
# To do so, remove the `Install the Apple certificate and provisioning profile` step,
# and replace this step with:
# run: |
# npm run package
# codesign --force --deep -s - ./out/*/*.app
# npm run publish -- --skip-package
#
# This reverts the program to the error that is usually seen on Intel Macs:
# ("LC3Tools.app" cannot be opened because Apple cannot check it for malicious software.)
#
# https://github.com/electron-userland/electron-builder/issues/5850#issuecomment-1821648559
run: |
npm run publish