-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (78 loc) · 3.31 KB
/
build_windows_installer.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
# Workflow building the Windows Installer file
name: Build Windows Installer
on:
# Runs on pushes on the default branch
push:
branches: ["main"]
# Runs on pull requests targeting the default branch
pull_request:
types: [opened, edited, reopened, synchronize]
branches: ["main"]
# Runs automatically every first day of the month
schedule:
- cron: '0 12 1 * *'
# May also be started manually
workflow_dispatch:
jobs:
# Builds the Windows installer, tests it, and uploads it
build-windows-installer:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Set up Python 3.10
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
# Build the wheel for the latest version
- name: Build Wheel
run: |
python -m venv ${{ github.workspace }}\venv
${{ github.workspace }}\venv\Scripts\python.exe -m pip install --upgrade pip wheel build setuptools
${{ github.workspace }}\venv\Scripts\python.exe -m build ${{ github.workspace }} -o ${{ github.workspace }}\dist
# Generates the .msi file using Advanced Installer
- name: Generate MSI
uses: caphyon/[email protected]
with:
advinst-version: '20.9.1'
advinst-enable-automation: 'true'
aip-path: ${{ github.workspace }}\src\windows_installer\config.aip
aip-build-name: DefaultBuild
aip-package-name: myofinder.msi
aip-output-dir: ${{ github.workspace }}\setup
# For some reason the installation directory needs to be manually created
- name: Create Installation Folder
shell: pwsh
run: mkdir "$env:localappdata\MyoFInDer"
# Execute the .msi installer to check that it operates as expected
# Also, record the logs to a log file
- name: Run Installer
shell: pwsh
run: If ((Start-Process msiexec -Wait -PassThru -ArgumentList "/I",
"${{ github.workspace }}\setup\myofinder.msi",
"/qn",
"/l*vx",
"${{ github.workspace }}\setup\log.txt").ExitCode -ne 0)
{exit 1} else
{Write-Output "::notice ::{MSI Installation succeeded}"}
# If the workflow is manually started, show some debug information
- name: Show Debug Info
if: contains(fromJSON('["workflow_dispatch"]'), github.event_name)
run: type ${{ github.workspace }}\setup\log.txt
# Getting the name of the wheel, cannot do it in the Windows shell
- name: Get Wheel Name
shell: bash
run: echo "WHEEL_NAME=$(echo '${{ github.workspace }}\dist\')$(ls '${{ github.workspace }}\dist' | grep \.whl$ | head -n 1)" >> $GITHUB_ENV
# Run the startup script installed by the .msi installer in test mode
- name: Run Startup Script
shell: cmd
run: '%localappdata%\MyoFInDer\start_myofinder.bat -t ${{ env.WHEEL_NAME }}'
# If the workflow is started manually or by a push, upload the .msi installer
- name: Upload Artifact
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
uses: actions/upload-artifact@v3
with:
name: myofinder.msi
path: ${{ github.workspace }}\setup\myofinder.msi
if-no-files-found: error