This repository was archived by the owner on Jul 18, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
148 lines (131 loc) · 4.92 KB
/
Copy pathbuild_windows.yml
File metadata and controls
148 lines (131 loc) · 4.92 KB
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
name: Build Windows installer
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
whl-url:
description: 'URL for Kolibri whl file'
required: true
release:
description: 'Is this a release asset?'
required: false
type: boolean
default: false
workflow_call:
inputs:
whl-file-name:
required: false
type: string
whl-url:
required: false
type: string
ref:
description: 'A ref for this workflow to check out its own repo'
required: false
type: string
release:
description: 'Is this a release asset?'
required: false
type: boolean
default: false
secrets:
AZURE_TENANT_ID:
required: false
AZURE_CLIENT_ID:
required: false
AZURE_CLIENT_SECRET:
required: false
outputs:
exe-file-name:
description: "EXE file name"
value: ${{ jobs.build_exe.outputs.exe-file-name }}
jobs:
build_exe:
name: Build EXE file
runs-on: windows-latest
outputs:
exe-file-name: ${{ steps.get-exe-filename.outputs.final-exe-file-name }}
steps:
- name: Validate whl reference inputs
if: ${{ (inputs.whl-file-name && inputs.whl-url) || (!inputs.whl-file-name && !inputs.whl-url) }}
run: |
echo "Must specify exactly one reference for the whl file to build the EXE with."
exit 1
- name: Check out code
uses: actions/checkout@v6
if: ${{ !inputs.ref }}
- name: Check out specific ref
uses: actions/checkout@v6
if: ${{ inputs.ref }}
with:
repository: learningequality/kolibri-app
ref: ${{ inputs.ref }}
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Cache pip dependencies
uses: actions/cache@v5
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'build_requires.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install build dependencies
run: make dependencies
- name: Install wget and Inno Setup
run: choco install wget innosetup --no-progress
- name: Download and install the whl from URL
if: ${{ inputs.whl-url }}
run: make get-whl whl=${{ inputs.whl-url }}
- name: Download the whl from artifacts
if: ${{ inputs.whl-file-name }}
uses: actions/download-artifact@v7
with:
name: ${{ inputs.whl-file-name }}
path: whl
- name: Install whl from artifacts
if: ${{ inputs.whl-file-name }}
run: make install-whl whl=whl/${{ inputs.whl-file-name }}
- name: Build the application with PyInstaller
run: make pyinstaller
- name: Build the Windows installer
run: make build-installer-windows
- name: Get EXE filenames
id: get-exe-filename
shell: pwsh
run: |
$baseName = (Get-ChildItem -Path dist-installer -Filter *.exe).BaseName
$unsignedName = "$baseName-unsigned.exe"
# The final name depends on whether this is a release build
$finalName = if ('${{ inputs.release }}' -eq 'true') { "$baseName.exe" } else { $unsignedName }
# Rename the built file to have the "-unsigned" suffix
Rename-Item -Path "dist-installer\$baseName.exe" -NewName $unsignedName
echo "unsigned-exe-file-name=$unsignedName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "final-exe-file-name=$finalName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Sign installer with Azure Trusted Signing
if: ${{ inputs.release }}
uses: azure/trusted-signing-action@v0
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: 'https://wus2.codesigning.azure.net/'
trusted-signing-account-name: 'LE-Trusted-Signing-Acct'
certificate-profile-name: 'LE-Windows-Certificates'
files-folder: dist-installer
files-folder-filter: ${{ steps.get-exe-filename.outputs.unsigned-exe-file-name }}
file-digest: SHA256
timestamp-rfc3161: 'http://timestamp.acs.microsoft.com'
timestamp-digest: 'SHA256'
- name: Prepare Final Artifact
if: ${{ inputs.release }}
shell: pwsh
run: |
# Only for a release, rename the file from "-unsigned.exe" to its final name after signing.
Rename-Item -Path "dist-installer\${{ steps.get-exe-filename.outputs.unsigned-exe-file-name }}" -NewName "${{ steps.get-exe-filename.outputs.final-exe-file-name }}"
- name: Upload installer artifact
uses: actions/upload-artifact@v6
with:
name: ${{ steps.get-exe-filename.outputs.final-exe-file-name }}
path: dist-installer/${{ steps.get-exe-filename.outputs.final-exe-file-name }}