-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (169 loc) · 5.97 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
name: build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@master
with:
node-version: 20
- name: install dependencies electron-app
run: npm install
working-directory: electron-app
- name: install dependencies server
run: npm install
working-directory: server
- name: lint/format electron-app
env:
CI: false
run: npm run ci:format
working-directory: electron-app
- name: lint/format server
env:
CI: false
run: npm run ci:format
working-directory: server
- name: test
env:
CI: false
run: npm run test
working-directory: server
- name: Get package version
run: node utils/get-version.js >> $GITHUB_ENV
- name: Tag if new version
uses: pkgdeps/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
version: ${{ env.PACKAGE_VERSION }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: 'v'
pre-release:
name: 'Pre Release'
needs: build
runs-on: 'ubuntu-latest'
outputs:
release-desktop: ${{ steps.release.outputs.released }}
release-tag: ${{ steps.release.outputs.release_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Release
uses: justincy/[email protected]
id: release
build_macos_linux:
runs-on: ${{ matrix.os }}
needs: pre-release
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
if: startsWith(matrix.os, 'macos')
with:
python-version: '3.11'
- uses: actions/setup-node@master
with:
node-version: 20
- name: Set version in source
run: |-
node utils/set-version.js electron-app/package.json
node utils/set-version.js electron-app/src/index.ts
- name: install dependencies electron-app
run: npm install
working-directory: electron-app
- name: install dependencies server
run: npm install
working-directory: server
- name: compile server
env:
CI: false
run: npm run compile
working-directory: server
- name: Add MacOS certs
if: startsWith(matrix.os, 'macos')
run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh
working-directory: electron-app
env:
CERTIFICATE_OSX_APPLICATION_BASE64: ${{ secrets.CERTIFICATE_OSX_APPLICATION_BASE64 }}
CERTIFICATE_OSX_PASSWORD: ${{ secrets.CERTIFICATE_OSX_PASSWORD }}
- name: Prepare for app notarization
if: startsWith(matrix.os, 'macos')
run: |-
mkdir -p ~/private_keys/
echo '${{ secrets.APPLE_API_SECRET_BASE_64 }}' | base64 --decode > ~/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8
- name: make
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_API_KEY: '~/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8'
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
CI: false
run: npm run make
- name: Release MacOSX installer
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'macos')
with:
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: |
electron-app/out/make/*.dmg
- name: Release Linux installer
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'ubuntu')
with:
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: |
electron-app/out/make/deb/x64/*.deb
electron-app/out/make/rpm/x64/*.rpm
build_job_windows:
runs-on: self-hosted
needs: pre-release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@master
with:
node-version: 20
- name: Set version in source
run: |-
node utils/set-version.js electron-app/package.json
node utils/set-version.js electron-app/src/index.ts
- name: install dependencies electron-app
run: npm install
working-directory: electron-app
- name: install dependencies server
run: npm install
working-directory: server
- name: compile server
env:
CI: false
run: npm run compile
working-directory: server
- name: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
CERTIFICATE_CONTAINER_ID: ${{ secrets.CERTIFICATE_CONTAINER_ID }}
CERTIFICATE_READER: ${{ secrets.CERTIFICATE_READER }}
run: |
Copy-Item server/src electron-app/src/sync-agent -r
npm run make-win
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f C:\Users\user\Documents\nuclia-certificate.cer /csp "eToken Base Cryptographic Provider" /kc "[$env:CERTIFICATE_READER{{$env:CERTIFICATE_PASSWORD}}]=$env:CERTIFICATE_CONTAINER_ID" electron-app/out/make/squirrel.windows/x64/Nuclia-Sync-Setup.exe
- name: Release Windows installer
uses: softprops/action-gh-release@v1
if: needs.pre-release.outputs.release-desktop == 'true'
with:
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: |
C:/Users/user/actions-runner/_work/sync-agent/sync-agent/electron-app/out/make/squirrel.windows/x64/Nuclia-Sync-Setup.exe