-
Notifications
You must be signed in to change notification settings - Fork 1
327 lines (281 loc) · 10.5 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
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
---
name: Build
on:
push:
paths-ignore:
- '*.md'
jobs:
check_release:
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
name: Check Release
runs-on: ubuntu-latest
outputs:
latest_release: ${{ steps.release_info.outputs.latest_release }}
current_version: ${{ steps.release_info.outputs.current_version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get Release Info
id: release_info
run: |
LATEST_RELEASE="$(curl -s https://api.github.com/repos/GeorgOhneH/ethz-document-fetcher/releases/latest | jq -r '.tag_name')"
CURRENT_VERSION="$(cat version.txt)"
echo "::set-output name=latest_release::$LATEST_RELEASE"
echo "::set-output name=current_version::$CURRENT_VERSION"
shell: sh
build:
needs: check_release
if: (needs.check_release.outputs.latest_release != needs.check_release.outputs.current_version)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Cache pip (Ubuntu)
uses: actions/cache@v2
if: startsWith(runner.os, 'ubuntu')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip (MacOS)
uses: actions/cache@v2
if: startsWith(runner.os, 'macos')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip (Windows)
uses: actions/cache@v2
if: startsWith(runner.os, 'windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install wheel -U
pip install -r requirements.txt -U
pip install boto3 -U
- name: Build Pyinstaller (Windows)
if: startsWith(matrix.os, 'windows')
shell: cmd
run: |
pip uninstall pyinstaller -y
git clone https://github.com/pyinstaller/pyinstaller.git
cd pyinstaller
git checkout tags/v4.2
cd bootloader
python ./waf all
cd ..
python setup.py install
- name: Install dependencies (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
pip install wheel -U
pip install dmgbuild -U
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get -y install p7zip-full
sudo apt-get -y install -qq libegl1-mesa
- name: Init PyUpdater
run: python .CI/prepare_files.py
env:
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }}
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }}
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
shell: cmd
run: |
set /p VERSION=<version.txt
pyupdater build --app-version=%VERSION:~1% win.spec --pyinstaller-log-info
- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
VERSION="$(cat version.txt)"
pyupdater build --app-version=${VERSION:1} mac.spec --pyinstaller-log-info
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
VERSION="$(cat version.txt)"
pyupdater build --app-version=${VERSION:1} linux.spec --pyinstaller-log-info
- name: Unzip
run: python .CI/unzip.py
- name: Create patches
run: pyupdater pkg --process
- name: Cryptographically Sign
run: pyupdater pkg --sign --slit-version
- name: Upload Release (Windows)
if: startsWith(matrix.os, 'windows')
run: pyupdater upload --service s3
env:
PYU_AWS_BUCKET: ethz-document-fetcher-win32
PYU_AWS_BUCKET_REGION: eu-central-1
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }}
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }}
- name: Upload Release (MacOS)
if: startsWith(matrix.os, 'macos')
run: pyupdater upload --service s3
env:
PYU_AWS_BUCKET: ethz-document-fetcher-darwin
PYU_AWS_BUCKET_REGION: eu-central-1
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }}
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }}
- name: Upload Release (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: pyupdater upload --service s3
env:
PYU_AWS_BUCKET: ethz-document-fetcher-linux
PYU_AWS_BUCKET_REGION: eu-central-1
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }}
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }}
- name: Upload PyUpdater Data
run: python .CI/upload_pyuppdate_data.py
env:
PYU_AWS_ID: ${{ secrets.PYU_AWS_ID }}
PYU_AWS_SECRET: ${{ secrets.PYU_AWS_SECRET }}
- name: Package (Windows)
if: startsWith(matrix.os, 'windows')
run: 7z a ethz-document-fetcher-windows-x86-64.zip ./distwin/ethz-document-fetcher/*
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v1
with:
name: ethz-document-fetcher-windows-x86-64.zip
path: ethz-document-fetcher-windows-x86-64.zip
- name: Download ApplicationID plugin for NSIS (Windows)
if: startsWith(matrix.os, 'windows')
uses: carlosperate/[email protected]
with:
file-url: https://github.com/connectiblutz/NSIS-ApplicationID/releases/download/1.1/NSIS-ApplicationID.zip
file-name: applicationid_plugin.zip
location: ${{ github.workspace }}\NSIS_Plugins
- name: Extract ApplicationID plugin (Windows)
if: startsWith(matrix.os, 'windows')
run: |
cd .\NSIS_Plugins
7z x .\applicationid_plugin.zip
rename Release x86-ansi
rename ReleaseUnicode x86-unicode
shell: cmd
- name: Create installer (Windows)
if: startsWith(matrix.os, 'windows')
uses: joncloud/[email protected]
with:
script-file: "./.CI/windows_installer.nsi"
additional-plugin-paths: "./NSIS_Plugins/"
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v1
with:
name: ethz-document-fetcher-windows-x86-64-installer.exe
path: ethz-document-fetcher-windows-x86-64-installer.exe
- name: Package (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
dmgbuild --settings ./.CI/dmg-settings.py -D app=./distmac/ethz-document-fetcher.app ethz-document-fetcher ethz-document-fetcher-osx.dmg
- name: Upload artifact (MacOS)
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v1
with:
name: ethz-document-fetcher-osx.dmg
path: ethz-document-fetcher-osx.dmg
- name: Package (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: sh ./.CI/create_app_image.sh
shell: bash
- name: Upload artifact (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v1
with:
name: ethz-document-fetcher-linux-x86_64.AppImage
path: ethz-document-fetcher-linux-x86_64.AppImage
create-release:
needs: [build, check_release]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.check_release.outputs.current_version }}
release_name: Release ${{ needs.check_release.outputs.current_version }}
body:
draft: false
prerelease: false
- uses: actions/download-artifact@v1
with:
name: ethz-document-fetcher-windows-x86-64.zip
path: windows/
- uses: actions/download-artifact@v1
with:
name: ethz-document-fetcher-windows-x86-64-installer.exe
path: windows/
- uses: actions/download-artifact@v1
with:
name: ethz-document-fetcher-linux-x86_64.AppImage
path: linux/
- uses: actions/download-artifact@v1
with:
name: ethz-document-fetcher-osx.dmg
path: macos/
# - name: Read upload URL into output
# id: upload_url
# run: |
# echo "::set-output name=upload_url::$(cat release-upload-url.txt/release-upload-url.txt)"
- name: Upload release asset zip (Windows)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows/ethz-document-fetcher-windows-x86-64.zip
asset_name: ethz-document-fetcher-windows-x86-64.zip
asset_content_type: application/zip
- name: Upload release asset exe (Windows)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows/ethz-document-fetcher-windows-x86-64-installer.exe
asset_name: ethz-document-fetcher-windows-x86-64-installer.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload release asset (Ubuntu)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux/ethz-document-fetcher-linux-x86_64.AppImage
asset_name: ethz-document-fetcher-linux-x86_64.AppImage
asset_content_type: application/x-executable
- name: Upload release asset (MacOS)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos/ethz-document-fetcher-osx.dmg
asset_name: ethz-document-fetcher-osx.dmg
asset_content_type: application/x-bzip2