-
Notifications
You must be signed in to change notification settings - Fork 1
264 lines (227 loc) · 8.44 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
---
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: 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
sudo apt-get -y install fuse libfuse2
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
shell: cmd
run: |
pyinstaller win.spec
- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
pyinstaller mac.spec
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
pyinstaller linux.spec
- name: Package (Windows)
if: startsWith(matrix.os, 'windows')
run: 7z a ethz-document-fetcher-windows-x86-64.zip ./dist/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=./dist/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/[email protected]
with:
name: ethz-document-fetcher-windows-x86-64.zip
path: windows/
- uses: actions/[email protected]
with:
name: ethz-document-fetcher-windows-x86-64-installer.exe
path: windows/
- uses: actions/[email protected]
with:
name: ethz-document-fetcher-linux-x86_64.AppImage
path: linux/
- uses: actions/[email protected]
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