-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (174 loc) · 7.45 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
name: Build Electron App
on:
push:
branches:
- main
pull_request:
jobs:
build-macos:
runs-on: macos-latest
if: ${{ github.event.head_commit.message != 'Automated commit by GitHub Actions' }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.10.0'
- name: Install Python and set up venv
run: |
brew install python@3.9
python3.9 -m venv myenv
source myenv/bin/activate
python3.9 -m ensurepip
python3.9 -m pip install --upgrade pip
python3.9 -m pip install setuptools
working-directory: ./jccm
- name: Install dependencies
run: |
source myenv/bin/activate
npm install
working-directory: ./jccm
- name: Install appdmg
run: |
source myenv/bin/activate
npm install --save-dev appdmg
working-directory: ./jccm
- name: Build and package (x64)
run: |
source myenv/bin/activate
npm run make -- --platform=darwin --arch=x64
working-directory: ./jccm
- name: Build and package (arm64)
run: |
source myenv/bin/activate
npm run make -- --platform=darwin --arch=arm64
working-directory: ./jccm
- name: Decode signing certificate
run: |
echo "${{ secrets.SIGNING_CERTIFICATE }}" | base64 --decode > signing_certificate.p12
shell: bash
- name: Install signing certificate
run: |
KEYCHAIN_NAME=build.keychain
KEYCHAIN_PASSWORD=$(openssl rand -base64 12)
echo "Creating keychain..."
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_NAME
echo "Importing certificate..."
security import signing_certificate.p12 -k $KEYCHAIN_NAME -P "${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign
echo "Listing keychains..."
security list-keychains -s $KEYCHAIN_NAME
echo "Setting default keychain..."
security default-keychain -s $KEYCHAIN_NAME
echo "Unlocking keychain..."
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_NAME
echo "Setting key partition list..."
security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN_NAME
- name: Sign the application
run: |
codesign --deep --force --verbose --sign "${{ secrets.DEVELOPER_ID }}" "./out/make/jccm-darwin-x64.dmg"
codesign --deep --force --verbose --sign "${{ secrets.DEVELOPER_ID }}" "./out/make/jccm-darwin-arm64.dmg"
codesign --verify "./out/make/jccm-darwin-x64.dmg"
codesign --verify "./out/make/jccm-darwin-arm64.dmg"
codesign -d "./out/make/jccm-darwin-arm64.dmg"
shell: bash
working-directory: ./jccm
- name: Upload macOS artifacts
uses: actions/upload-artifact@v2
with:
name: macos-installers
path: |
./jccm/out/make/jccm-darwin-x64.dmg
./jccm/out/make/jccm-darwin-arm64.dmg
build-windows:
needs: build-macos
runs-on: windows-latest
if: ${{ github.event.head_commit.message != 'Automated commit by GitHub Actions' }}
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.10.0'
- name: Install dependencies
run: npm install
working-directory: ./jccm
- name: Build and package (x64)
run: npm run make -- --platform=win32 --arch=x64
working-directory: ./jccm
- name: Upload windows artifacts
uses: actions/upload-artifact@v2
with:
name: windows-installers
path: |
./jccm/out/make/squirrel.windows/x64/*.exe
./jccm/out/make/squirrel.windows/x64/*.msi
release:
needs: [build-macos, build-windows]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.10.0'
- name: Read version from package.json
id: get_version
run: echo "VERSION=$(jq -r '.version' ./jccm/package.json)" >> $GITHUB_ENV
- name: Download macOS artifacts
uses: actions/download-artifact@v2
with:
name: macos-installers
path: ./installers/macos
- name: Download windows artifacts
uses: actions/download-artifact@v2
with:
name: windows-installers
path: ./installers/windows
- name: Install GitHub CLI
run: sudo apt-get install gh
- name: Check for existing release and delete if it exists
run: |
if gh release view ${{ env.VERSION }}; then
gh release delete ${{ env.VERSION }} --yes
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: 'Release ${{ env.VERSION }}'
draft: false
prerelease: false
- name: Upload macOS x64 Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./installers/macos/jccm-darwin-x64.dmg
asset_name: jccm-darwin-x64.dmg
asset_content_type: application/octet-stream
- name: Upload macOS arm64 Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./installers/macos/jccm-darwin-arm64.dmg
asset_name: jccm-darwin-arm64.dmg
asset_content_type: application/octet-stream
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./installers/windows/jccm-windows-x64-setup.exe
asset_name: jccm-windows-x64-setup.exe
asset_content_type: application/octet-stream