-
Notifications
You must be signed in to change notification settings - Fork 28
178 lines (175 loc) · 5.74 KB
/
cd-windows.yaml
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
name: Continuous delivery - Windows
on:
release:
types: [prereleased, released]
env:
FLIT_ROOT_INSTALL: 1
jobs:
version-check:
name: Check versioning
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check version tag format
run: |
$VERSION_TAG="${{ github.event.release.tag_name }}"
if ($VERSION_TAG -match "^v[0-9]+.[0-9]+.[0-9]+(-(rc|post)\.[1-9])?$") {exit 0} else {exit 1}
- name: Check if version tag and package version are equal
run: |
$VERSION_TAG="${{ github.event.release.tag_name }}"
$VERSION_FILE=Get-Content .\pynitrokey\VERSION
if ($VERSION_TAG.Substring(1) -eq $VERSION_FILE) {exit 0} else {exit 1}
build-onedir:
name: Build onedir
runs-on: windows-latest
needs: version-check
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create virtual environment
run: |
python -m venv venv
.\venv\Scripts\Activate.ps1
.\venv\Scripts\pip install pip
.\venv\Scripts\pip install flit
.\venv\Scripts\flit install --symlink
- name: Create Windows version info file
run: |
.\venv\Scripts\Activate.ps1
create-version-file `
--outfile .\ci-scripts\windows\pyinstaller\file_version_info.txt `
--version "$(Get-Content .\pynitrokey\VERSION)" `
.\ci-scripts\windows\pyinstaller\file_version_info_metadata.yaml
- name: Build onedir
run: |
.\venv\Scripts\Activate.ps1
pyinstaller ci-scripts/windows/pyinstaller/pynitrokey-onedir.spec
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pynitrokey-onedir
path: dist/nitropy
build-onefile:
name: Build onefile
runs-on: windows-latest
needs: version-check
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create virtual environment
run: |
python -m venv venv
.\venv\Scripts\Activate.ps1
.\venv\Scripts\pip install pip
.\venv\Scripts\pip install flit
.\venv\Scripts\flit install --symlink
- name: Create Windows version info file
run: |
.\venv\Scripts\Activate.ps1
create-version-file `
--outfile .\ci-scripts\windows\pyinstaller\file_version_info.txt `
--version "$(Get-Content .\pynitrokey\VERSION)" `
.\ci-scripts\windows\pyinstaller\file_version_info_metadata.yaml
- name: Build onefile
run: |
.\venv\Scripts\Activate.ps1
pyinstaller ci-scripts/windows/pyinstaller/pynitrokey-onefile.spec
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pynitrokey-onefile
path: dist/nitropy.exe
build-msi-installer:
name: Build MSI installer
runs-on: windows-latest
needs: build-onedir
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: pynitrokey-onedir
path: dist/nitropy
- name: Create sources file
run: |
$Env:Path += ";" + "$Env:WIX" + "bin"
heat `
dir .\dist\nitropy\ `
-dr INSTALLFOLDER `
-ag `
-cg ApplicationFilesDynamic `
-ke `
-srd -sfrag -suid -sreg `
-nologo `
-pog:Binaries `
-pog:Documents `
-pog:Satellites `
-pog:Sources `
-pog:Content `
-o Sources.wxs
- name: Build object files
run: |
$Env:Path += ";" + "$Env:WIX" + "bin"
candle .\ci-scripts\windows\wix\Product.wxs -o Product.wixobj
candle .\Sources.wxs -o .\Sources.wixobj
- name: Build installer package
run: |
$Env:Path += ";" + "$Env:WIX" + "bin"
light `
-b .\dist\nitropy\ `
-sice:ICE80 `
.\Product.wixobj `
.\Sources.wixobj `
-o nitropy.msi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nitropy-installer
path: nitropy.msi
publish-binary:
name: Publish binary
runs-on: windows-latest
needs: build-onefile
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: pynitrokey-onefile
- name: Rename binary
run: |
mv `
nitropy.exe `
nitropy-${{ github.event.release.tag_name }}-x64-windows-binary.exe
- name: Create archive
run: |
7z a -tzip -mx9 `
nitropy-${{ github.event.release.tag_name }}-x64-windows-binary.zip `
nitropy-${{ github.event.release.tag_name }}-x64-windows-binary.exe
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: nitropy-${{ github.event.release.tag_name }}-x64-windows-binary.zip
publish-msi-installer:
name: Publish MSI installer
runs-on: windows-latest
needs: build-msi-installer
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: nitropy-installer
- name: Rename installer
run: |
mv `
nitropy.msi `
nitropy-${{ github.event.release.tag_name }}-x64-windows-installer.msi
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: nitropy-${{ github.event.release.tag_name }}-x64-windows-installer.msi