-
Notifications
You must be signed in to change notification settings - Fork 35
616 lines (548 loc) · 24.7 KB
/
deployment.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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
name: Deployment
concurrency: production
on:
push:
tags:
- "v*"
branches:
- "master"
- "develop"
- "github-actions"
- "gha-*"
env:
# We want to see all warnings for the project, but hide them for Libtorrent:
CXX_FLAGS_Libtorrent: "-Wall -Wextra -Wpedantic -Wvla -Wno-noexcept-type -Wno-format-zero-length -ftemplate-depth=512 -Wno-attributes -Wno-narrowing -Wno-overflow -Wno-redundant-move -Wno-maybe-uninitialized" # -Wa,-mbig-obj"
CXX_FLAGS_Project: "-Wall -Wextra -Wpedantic -Wvla -ftemplate-depth=512"
BUILD_TYPE: "Release" # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BOOST_VERSION: 1.77.0
BOOST_PATH: ${{github.workspace}}/../install/boost/
#rem qt_standard_project_setup() was introduced in Qt 6.3.
Qt6_VERSION: 6.6.0
LibtorrentRasterbar_SOURCE_DIR: ${{github.workspace}}/3rd/libtorrent-rasterbar
LibtorrentRasterbar_BUILD_DIR: ${{github.workspace}}/00/build/libtorrent-rasterbar
LibtorrentRasterbar_INSTALL_DIR: ${{github.workspace}}/00/install/libtorrent-rasterbar
# ^^
# HACK cache@v3: using '/00/' instead of '/../': Relative pathing '.' and '..' is not allowed.
LibtorrentRasterbar_VERSION_FILE: ${{github.workspace}}/3rd/libtorrent-rasterbar/include/libtorrent/version.hpp
Application_VERSION_FILE: ${{github.workspace}}/version
Changelog_FILE_NAME: ${{github.workspace}}/00/GIT-CHANGELOG.txt
Project_SOURCE_DIR: ${{github.workspace}}
Project_BUILD_DIR: ${{github.workspace}}/00/build/project
Project_INSTALL_DIR: ${{github.workspace}}/00/install/project
Project_RELEASE_DIR: ${{github.workspace}}/00/release
jobs:
job-web-addons:
name: "Build WebBrowser Addons"
runs-on: ubuntu-latest # Ubuntu seems faster than Windows
environment: production
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Create WebBrowser Addons
id: webaddons
shell: python
working-directory: "${{env.Project_SOURCE_DIR}}/web-extension/extension"
run: |
import sys
sys.path.append(".")
import os
import shutil
from make import make_addons
current_path = r"${{env.Project_SOURCE_DIR}}/web-extension/extension"
output_path = "${{env.Project_SOURCE_DIR}}/web-extension/extension"
result = make_addons(current_path=current_path, output_path=output_path)
artifact_chromium = result['chromium']
artifact_firefox = result['firefox']
if "GITHUB_OUTPUT" in os.environ:
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
print(f"Addon_Web_Extension_Chromium={ artifact_chromium }", file=f)
print(f"Addon_Web_Extension_Firefox={ artifact_firefox }", file=f)
- name: Upload Chromium Addon
uses: actions/upload-artifact@v3
with:
name: artifact_chromium
path: ${{ steps.webaddons.outputs.Addon_Web_Extension_Chromium }}
- name: Upload Firefox Addon
uses: actions/upload-artifact@v3
with:
name: artifact_firefox
path: ${{ steps.webaddons.outputs.Addon_Web_Extension_Firefox }}
job-build-project:
name: "Build Project on ${{matrix.os}}"
strategy:
fail-fast: false
matrix:
os: [windows-latest]
include:
#- os: ubuntu-latest # == ubuntu-20.04: for Linux builds, Qt6 requires Ubuntu 20.04 or later.
# qt_host: 'linux'
# qt_target: 'desktop'
# qt_arch: 'gcc_64'
# qt_tools: '' # To build OpenSSLv3: 'tools_opensslv3_src'
# Qt6_CUSTOM_INSTALL_PATH: "/home/runner/work/DownZemAll/qt/"
# DIRECTIVE_CMAKE_GENERATOR: ''
# INSTALL_BOOST_PLATFORM_VERSION: '18.04' # 18.04, 20.04 Rem: Ubuntu 20.04 doesn't have Boost 1.77.0
# INSTALL_BOOST_TOOLSET: '' # gcc Rem: Setting the toolset with boost version < 1.78.0 may cause issues
# INSTALL_BOOST_ARCH: '' # x86
- os: windows-latest
qt_host: 'windows'
qt_target: 'desktop'
qt_arch: 'win64_mingw'
qt_tools: 'tools_opensslv3_x64'
Qt6_CUSTOM_INSTALL_PATH: "D:\\a\\DownZemAll\\qt\\"
DIRECTIVE_CMAKE_GENERATOR: '-G "MinGW Makefiles"'
INSTALL_BOOST_PLATFORM_VERSION: '2019' # 2019, 2022
INSTALL_BOOST_TOOLSET: '' # mingw, msvc Rem: Setting the toolset with boost version < 1.78.0 may cause issues
INSTALL_BOOST_ARCH: '' # x86
runs-on: ${{matrix.os}}
environment: production
steps:
- name: Check out repository code
uses: actions/checkout@v3
# - name: Clean Environment
# shell: python # otherwise Windows uses Powershell, Linux uses bash
# run: |
# import os
#
# print("Clean Relative pathing in ENV,")
# print("to avoir error of 'Invalid pattern 'a/../././b'.")
# print("Relative pathing '.' and '..' is not allowed.")
#
# output_pairs = {
# 'LibtorrentRasterbar_SOURCE_DIR': r"${{env.LibtorrentRasterbar_SOURCE_DIR}}",
# 'LibtorrentRasterbar_BUILD_DIR': r"${{env.LibtorrentRasterbar_BUILD_DIR}}",
# 'LibtorrentRasterbar_INSTALL_DIR': r"${{env.LibtorrentRasterbar_INSTALL_DIR}}",
# 'LibtorrentRasterbar_VERSION_FILE': r"${{env.LibtorrentRasterbar_VERSION_FILE}}",
# 'Application_VERSION_FILE': r"${{env.Application_VERSION_FILE}}",
# 'Changelog_FILE_NAME': r"${{env.Changelog_FILE_NAME}}",
# 'Project_SOURCE_DIR': r"${{env.Project_SOURCE_DIR}}",
# 'Project_BUILD_DIR': r"${{env.Project_BUILD_DIR}}",
# 'Project_INSTALL_DIR': r"${{env.Project_INSTALL_DIR}}",
# 'Project_RELEASE_DIR': r"${{env.Project_RELEASE_DIR}}",
# }
#
# if "GITHUB_OUTPUT" in os.environ:
# with open(os.environ["GITHUB_OUTPUT"], "a") as my_file:
# for key, value in output_pairs.items():
# new_value = os.path.normpath(value)
# print(f"Modify {key}")
# print(f" from: {value}")
# print(f" to : {new_value}")
# print(f"{key}={new_value}", file=my_file)
#
- name: Prepare Directories
shell: python # otherwise Windows uses Powershell, Linux uses bash
run: |
import os
directories = [
r"${{env.LibtorrentRasterbar_BUILD_DIR}}",
r"${{env.LibtorrentRasterbar_INSTALL_DIR}}",
r"${{env.Project_BUILD_DIR}}",
r"${{env.Project_INSTALL_DIR}}",
r"${{env.Project_RELEASE_DIR}}",
]
for directory in directories:
if not os.path.isdir(directory):
os.makedirs(directory)
print(f"Created: {directory}")
- name: Read VERSION files
id: getversion
working-directory: "${{env.Project_SOURCE_DIR}}"
shell: python
run: |
import os
import re
regex_major = re.compile(r"#define LIBTORRENT_VERSION_MAJOR (?P<value>\d+)")
regex_minor = re.compile(r"#define LIBTORRENT_VERSION_MINOR (?P<value>\d+)")
regex_tiny = re.compile(r"#define LIBTORRENT_VERSION_TINY (?P<value>\d+)")
with open(r"${{env.Application_VERSION_FILE}}", "rt") as my_file:
version = my_file.readline()
version = ''.join(version.split())
with open(r"${{env.LibtorrentRasterbar_VERSION_FILE}}", "rt") as my_file:
for line in my_file:
x = regex_major.search(line)
if x is not None:
version_major = x.group('value')
x = regex_minor.search(line)
if x is not None:
version_minor = x.group('value')
x = regex_tiny.search(line)
if x is not None:
version_tiny = x.group('value')
if version_major is not None and len(str(version_major)) > 0:
libtorrent_version = f"{version_major}.{version_minor}.{version_tiny}"
else:
libtorrent_version = ""
output_pairs = {
'Application_VERSION': version,
'LibtorrentRasterbar_VERSION': libtorrent_version,
'Application_Linux_NAME': f"DownZemAll_v{version}_x86_64",
'Application_Windows_MinGW_x64_NAME': f"DownZemAll_v{version}_windows-mingw-x64",
}
if "GITHUB_OUTPUT" in os.environ:
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
for key, value in output_pairs.items():
if value is None or str(value) == "":
print(f"Error: Empty value for '{key}' in {output_pairs}.")
exit(1)
print(f"{key}={value}", file=f)
- name: Echo Versions
env:
Application_VERSION: ${{ steps.getversion.outputs.Application_VERSION }}
LibtorrentRasterbar_VERSION: ${{ steps.getversion.outputs.LibtorrentRasterbar_VERSION }}
shell: bash # otherwise Windows uses Powershell
run: |
echo "Application_VERSION: '${{env.Application_VERSION}}'"
echo "LibtorrentRasterbar_VERSION: '${{env.LibtorrentRasterbar_VERSION}}'"
- name: Cache Libtorrent Static Libraries
uses: actions/cache@v3
id: cache-libtorrent
env:
LibtorrentRasterbar_VERSION: ${{ steps.getversion.outputs.LibtorrentRasterbar_VERSION }}
with:
key: libtorrent-rasterbar-${{ matrix.os }}-v${{env.LibtorrentRasterbar_VERSION}}
restore-keys: |
libtorrent-rasterbar-${{ matrix.os }}
path: |
${{env.LibtorrentRasterbar_INSTALL_DIR}}
- name: Install Boost
uses: MarkusJx/install-boost@v2.4.3
id: install-boost
with:
boost_version: ${{env.BOOST_VERSION}}
boost_install_dir: ${{env.BOOST_PATH}}
platform_version: ${{matrix.INSTALL_BOOST_PLATFORM_VERSION}}
toolset: ${{matrix.INSTALL_BOOST_TOOLSET}}
arch: ${{matrix.INSTALL_BOOST_ARCH}}
cache: true
- name: List files in Boost (if Debug Logging is enabled)
if: runner.debug == '1'
shell: bash
env:
Installed_Boost_VER: ${{ steps.install-boost.outputs.Boost_VER }}
Installed_Boost_ROOT: ${{ steps.install-boost.outputs.Boost_ROOT }}
run: |
echo "Installed version: ${{env.Installed_Boost_VER}}"
echo "Installation Dir: ${{env.Installed_Boost_ROOT}}"
echo ""
cd "${{env.Installed_Boost_ROOT}}"
ls -al
- name: Install Qt
uses: jurplel/install-qt-action@v3
# Rem: Once installed, ${{env.Qt6_DIR}} is set.
# https://ddalcino.github.io/aqt-list-server/
with:
aqtversion: '==3.1.*'
version: ${{env.Qt6_VERSION}}
dir: ${{matrix.Qt6_CUSTOM_INSTALL_PATH}}
host: ${{matrix.qt_host}}
target: ${{matrix.qt_target}}
arch: ${{matrix.qt_arch}}
tools: ${{matrix.qt_tools}}
cache: true
- name: List files in Qt (if Debug Logging is enabled)
if: runner.debug == '1'
shell: bash
run: cd "${{env.Qt6_DIR}}/../../" && ls -alR
# env.Qt6_DIR
# "/home/runner/work/DownZemAll/qt/Qt/6.3.1/gcc_64"
# "D:\a\DownZemAll\qt\Qt\6.3.1\mingw_64"
- name: Find OpenSSL in Qt6
# The thing is that "env.Qt6_DIR" is defined only at runtime, *after* install-qt-action has run.
id: qt6openssl
shell: python
# 2 versions present in Ubuntu:
# * Default version (3.0.2-0ubuntu1.12)
# in /usr/ (see "apt list libssl-dev")
# => openssl_dir = os.path.normpath("/usr")
#
# * Qt6 version (3.0.12)
# To build it:
# openssl_dir = os.path.normpath(os.path.join(r"${{env.Qt6_DIR}}", "..", "..", "Tools", "OpenSSLv3", "src"))
# cd "${{openssl_dir}}"
# ./config
# make
# make test
# sudo make install_sw
# Then:
# openssl_dir = os.path.normpath(os.path.join(r"${{env.Qt6_DIR}}", "..", "..", "Tools", "OpenSSLv3", "src"))
# openssl_lib_eay = os.path.normpath(os.path.join(openssl_dir, "lib", "libcrypto.a"))
# openssl_ssl_eay = os.path.normpath(os.path.join(openssl_dir, "lib", "libssl.a"))
#
run: |
import os
# OLD NAME -> NEW NAME
# libeay32 -> libcrypto
# ssleay32 -> libssl
if "${{ matrix.os }}" == "windows-latest":
openssl_dir = os.path.normpath(os.path.join(r"${{env.Qt6_DIR}}", "..", "..", "Tools", "OpenSSLv3", "Win_x64"))
openssl_lib_eay = os.path.normpath(os.path.join(openssl_dir, "lib", "libcrypto.lib"))
openssl_ssl_eay = os.path.normpath(os.path.join(openssl_dir, "lib", "libssl.lib"))
if "${{ matrix.os }}" == "ubuntu-latest":
openssl_dir = os.path.normpath("/usr")
openssl_lib_eay = os.path.normpath(os.path.join(openssl_dir, "lib", "x86_64-linux-gnu", "libcrypto.a"))
openssl_ssl_eay = os.path.normpath(os.path.join(openssl_dir, "lib", "x86_64-linux-gnu", "libssl.a"))
if "GITHUB_OUTPUT" in os.environ:
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
print(f"OpenSSL_ROOT_DIR={ openssl_dir }", file=f)
print(f"OpenSSL_LIB_EAY={ openssl_lib_eay }", file=f)
print(f"OpenSSL_SSL_EAY={ openssl_ssl_eay }", file=f)
- name: List files in OpenSSL (if Debug Logging is enabled)
if: runner.debug == '1'
shell: bash
env:
OpenSSL_ROOT_DIR: ${{ steps.qt6openssl.outputs.OpenSSL_ROOT_DIR }}
run: cd "${{env.OpenSSL_ROOT_DIR}}" && ls -alR
- name: Configure Libtorrent
if: ${{ steps.cache-libtorrent.outputs.cache-hit != 'true' }}
env:
Boost_ROOT: ${{ steps.install-boost.outputs.Boost_ROOT }}
Qt6_Dir2: ${{env.Qt6_DIR}}
DIRECTIVE_CMAKE_GENERATOR: ${{matrix.DIRECTIVE_CMAKE_GENERATOR}}
BUILD_TESTS: "OFF" # OFF because they take 10+ minutes to build and 776.74 sec to run tests on Ubuntu
DEPRECATED_FUNCTIONS: "OFF" # OFF to remove deprecated functions
OPENSSL_INCLUDE_DIR: "${{ steps.qt6openssl.outputs.OpenSSL_ROOT_DIR }}/include"
OpenSSL_LIB_EAY: ${{ steps.qt6openssl.outputs.OpenSSL_LIB_EAY }}
OpenSSL_SSL_EAY: ${{ steps.qt6openssl.outputs.OpenSSL_SSL_EAY }}
working-directory: "${{env.LibtorrentRasterbar_BUILD_DIR}}"
run:
cmake "${{env.LibtorrentRasterbar_SOURCE_DIR}}"
${{env.DIRECTIVE_CMAKE_GENERATOR}}
-DCMAKE_PREFIX_PATH="${{env.Qt6_Dir2}}"
-DCMAKE_CXX_FLAGS="${{env.CXX_FLAGS_Libtorrent}}"
-DCMAKE_INSTALL_PREFIX="${{env.LibtorrentRasterbar_INSTALL_DIR}}"
-DBoost_ROOT:PATH="${{env.Boost_ROOT}}"
-DBUILD_SHARED_LIBS=OFF
-Dstatic_runtime=ON
-Dbuild_tests=${{env.BUILD_TESTS}}
-Ddeprecated-functions=${{env.DEPRECATED_FUNCTIONS}}
-DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}"
-DOPENSSL_INCLUDE_DIR="${{env.OPENSSL_INCLUDE_DIR}}"
-DLIB_EAY="${{env.OpenSSL_LIB_EAY}}"
-DSSL_EAY="${{env.OpenSSL_SSL_EAY}}"
- name: Build Libtorrent
if: ${{ steps.cache-libtorrent.outputs.cache-hit != 'true' }}
working-directory: "${{env.LibtorrentRasterbar_BUILD_DIR}}"
run: cmake --build . --config "${{env.BUILD_TYPE}}"
- name: Test Libtorrent
if: ${{ steps.cache-libtorrent.outputs.cache-hit != 'true' }}
working-directory: "${{env.LibtorrentRasterbar_BUILD_DIR}}"
run: |
ctest -N # -N gets the list of all the tests in CTest
ctest . --verbose
- name: Install Libtorrent
if: ${{ steps.cache-libtorrent.outputs.cache-hit != 'true' }}
working-directory: "${{env.LibtorrentRasterbar_BUILD_DIR}}"
run: cmake --build . --target install
- name: List files in Libtorrent (if Debug Logging is enabled)
if: runner.debug == '1'
shell: bash
run: cd "${{env.LibtorrentRasterbar_INSTALL_DIR}}" && ls -alR
- name: Configure Project
env:
Boost_ROOT: ${{ steps.install-boost.outputs.Boost_ROOT }}
Qt6_Dir2: ${{env.Qt6_DIR}}
OpenSSL_ROOT_DIR: ${{ steps.qt6openssl.outputs.OpenSSL_ROOT_DIR }}
DIRECTIVE_CMAKE_GENERATOR: ${{matrix.DIRECTIVE_CMAKE_GENERATOR}}
working-directory: "${{env.Project_BUILD_DIR}}"
run:
cmake "${{env.Project_SOURCE_DIR}}"
${{env.DIRECTIVE_CMAKE_GENERATOR}}
-DCMAKE_PREFIX_PATH="${{env.Qt6_Dir2}}"
-DCMAKE_CXX_FLAGS="${{env.CXX_FLAGS_Project}}"
-DCMAKE_INSTALL_PREFIX="${{env.Project_INSTALL_DIR}}"
-DOpenSSL_ROOT_DIR="${{env.OpenSSL_ROOT_DIR}}"
-DBoost_ROOT:PATH="${{env.Boost_ROOT}}"
-DLibtorrentRasterbar_ROOT:PATH="${{env.LibtorrentRasterbar_INSTALL_DIR}}"
-DBUILD_LAUNCHER=ON
-DBUILD_MAIN_APPLICATION=ON
-DBUILD_TESTS=OFF
-DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}"
- name: Build Project
working-directory: "${{env.Project_BUILD_DIR}}"
run: cmake --build . --config "${{env.BUILD_TYPE}}"
- name: Test Project
continue-on-error: true
working-directory: "${{env.Project_BUILD_DIR}}"
run: |
ctest -N # -N gets the list of all the tests in CTest
ctest . --verbose
- name: Install Project
working-directory: "${{env.Project_BUILD_DIR}}"
run: cmake --build . --target install
- name: Strip
if: ${{ matrix.os == 'ubuntu-latest' }}
continue-on-error: true
working-directory: "${{env.Project_INSTALL_DIR}}"
shell: bash
run: |
echo "Before:"
ls -al
strip "launcher"
strip "DownZemAll"
echo ""
echo "After:"
ls -al
- name: List Dynamic Dependencies (Linux Only)
if: ${{ matrix.os == 'ubuntu-latest' }}
working-directory: "${{env.Project_INSTALL_DIR}}"
continue-on-error: true
shell: bash
run: |
echo "Run 'ldd' to find missing Qt libraries or missing plugins."
echo "Tips: If missing, add directive install(FILE [..]) in 'src/CMakeLists.txt'."
ldd --verbose ./launcher
ldd --verbose ./DownZemAll
ls -R
- name: Zip (Linux Portable)
if: ${{ matrix.os == 'ubuntu-latest' }}
working-directory: "${{env.Project_RELEASE_DIR}}"
shell: bash
env:
TARBALL_NAME: "${{ steps.getversion.outputs.Application_Linux_NAME }}.tar.gz"
run: |
tar -zcvf ${{env.TARBALL_NAME}} -C "${{env.Project_INSTALL_DIR}}" .
cd "${{env.Project_INSTALL_DIR}}"
ls -al
- name: Upload Linux Portable
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
env:
TARBALL_NAME: "${{ steps.getversion.outputs.Application_Linux_NAME }}.tar.gz"
with:
name: artifact_linux_portable
path: "${{env.Project_RELEASE_DIR}}/${{env.TARBALL_NAME}}"
- name: Zip (Windows MingGW x64 Portable)
if: ${{ matrix.os == 'windows-latest' }}
working-directory: "${{env.Project_RELEASE_DIR}}"
shell: python
env:
ZIP_NAME: "${{ steps.getversion.outputs.Application_Windows_MinGW_x64_NAME }}"
run: |
import os
from shutil import make_archive
root_dir = os.path.normpath(r"${{env.Project_INSTALL_DIR}}")
print(f"Archiving {root_dir}")
full_name = make_archive(
base_name="${{env.ZIP_NAME}}",
format="zip",
root_dir=root_dir,
base_dir=".",
)
print(f"Archive: {full_name}")
- name: Upload Windows MingGW x64 Portable
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v3
env:
ZIP_NAME: "${{ steps.getversion.outputs.Application_Windows_MinGW_x64_NAME }}.zip"
with:
name: artifact_windows_mingw_64_portable
path: "${{env.Project_RELEASE_DIR}}/${{env.ZIP_NAME}}"
- name: Create NSIS installer
if: ${{ matrix.os == 'windows-latest' }}
uses: joncloud/makensis-action@v3.7
env:
Application_VERSION: ${{ steps.getversion.outputs.Application_VERSION }}
with:
script-file: "${{env.Project_SOURCE_DIR}}/installer/windows/NSIS/setup.nsi"
arguments: '/DPATH_OUT="${{env.Project_RELEASE_DIR}}" /DVERSION="${{env.Application_VERSION}}" /DPLATFORM="x64" /DBIN_PATH="${{env.Project_INSTALL_DIR}}"'
- name: List files in Project
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: cd "${{env.Project_INSTALL_DIR}}" && ls -alR
- name: Rename NSIS installer
if: ${{ matrix.os == 'windows-latest' }}
shell: python
run: |
import os
os.rename(
r"${{env.Project_RELEASE_DIR}}/DownZemAllSetup.exe",
r"${{env.Project_RELEASE_DIR}}/DownZemAll_x64_Setup.exe"
)
- name: Upload Windows 64 Installer
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v3
with:
name: artifact_windows_64_installer
path: "${{env.Project_RELEASE_DIR}}/DownZemAll_x64_Setup.exe"
job-deploy:
needs: [job-web-addons, job-build-project]
name: "Deploy"
runs-on: ubuntu-latest # Ubuntu seems faster than Windows
environment: production
steps:
- name: Prepare Directories
shell: python
run: |
import os
directory = r"${{env.Project_RELEASE_DIR}}"
if not os.path.isdir(directory):
os.makedirs(directory)
- name: Download Chromium Addon
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: artifact_chromium
path: "${{env.Project_RELEASE_DIR}}"
- name: Download Firefox Addon
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: artifact_firefox
path: "${{env.Project_RELEASE_DIR}}"
- name: Download Linux Portable
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: artifact_linux_portable
path: "${{env.Project_RELEASE_DIR}}"
- name: Download Windows MinGW 64 Portable
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: artifact_windows_mingw_64_portable
path: "${{env.Project_RELEASE_DIR}}"
- name: Download Windows 64 Installer
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: artifact_windows_64_installer
path: "${{env.Project_RELEASE_DIR}}"
- name: List files in Release
shell: bash
working-directory: "${{env.Project_RELEASE_DIR}}"
run: ls -al
- name: Generate Release Note
shell: python
run: |
#git log refs/heads/develop..${{ github.ref }} --oneline
lines = [
"## New:",
"",
"## Fixed:",
"",
"- [Category] First Change",
"- [Category] Second Change",
"",
"## Updated:",
"",
]
with open(r"${{env.Changelog_FILE_NAME}}", 'wt') as my_file:
for line in lines:
my_file.write(line)
my_file.write("\r\n")
- name: Publish
uses: softprops/action-gh-release@v0.1.15
#if: startsWith(github.ref, 'refs/tags/') # Limit releases to pushes to tags
env:
BRANCH_OR_TAG_NAME: ${{ github.head_ref || github.ref_name }}
with:
tag_name: ${{env.BRANCH_OR_TAG_NAME}}
name: DownZemAll ${{env.BRANCH_OR_TAG_NAME}}
body_path: ${{env.Changelog_FILE_NAME}}
append_body: true
generate_release_notes: true
draft: true
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{env.Project_RELEASE_DIR}}/*