-
Notifications
You must be signed in to change notification settings - Fork 0
213 lines (188 loc) · 6.99 KB
/
sub-build-windows.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
name: SUB - Build on Windows
on:
workflow_dispatch:
inputs:
env:
description: "An Environment"
required: true
type: choice
options:
- Development
- Production
version:
description: "A Version"
required: true
type: string
caching:
description: "Use caching"
required: true
type: boolean
default: false
workflow_call:
inputs:
env:
description: "An Environment"
required: true
type: string
version:
description: "A Version"
required: true
type: string
caching:
description: "Use caching"
required: true
type: boolean
default: false
env:
app_name: ${{ inputs.env == 'Production' && 'SuperHumanInstaller' || 'SuperHumanInstallerDev' }}
app_id: net.prominic.genesis.${{ inputs.env == 'Production' && 'superhumaninstaller' || 'superhumaninstallerdev' }}
haxe_flag: ${{ inputs.env == 'Production' && '-final' || '-debug -Dverbose_logs -Ddebug_logs' }}
haxe_version: 4.3.6
bin_path: X:/Export/${{ inputs.env }}/windows/bin/
jobs:
build:
runs-on: windows-latest
steps:
- name: Build info
run: |
echo "Ref: ${{ github.ref_name }}"
echo "Env: ${{ inputs.env }}"
echo "Version: ${{ inputs.version }}"
echo "App Name: ${{ env.app_name }}"
echo "App ID: ${{ env.app_id }}"
echo "Haxe Env Flag: ${{ env.haxe_flag }}"
- name: Checkout repo
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Map disk
shell: cmd
run: |
echo "Mapping drive X: to current directory..."
subst X: "%CD%"
echo "Directory mapped to X:"
dir X:
- name: Override project.xml version
uses: Moonshine-IDE/[email protected]
with:
filepath: "project.xml"
xpath: "/project/meta/@version"
replace: "${{ inputs.version }}"
- name: Set up Haxe
uses: Moonshine-IDE/setup-haxe-action@master
with:
haxe-version: ${{ env.haxe_version }}
- name: Show haxe info
run: |
echo "Haxe version:"
haxe -version
echo "Haxe lib path:"
haxelib config
- name: Update haxelib
run: haxelib --global update haxelib
- name: Cache Binaries
id: cache-bin
if: ${{ inputs.caching }}
uses: actions/cache@v4
with:
path: ${{ env.bin_path }}
key: ${{ env.app_name }}-windows-bin
- name: Install dependencies
if: ${{ !inputs.caching || !steps.cache-bin.outputs.cache-hit }}
working-directory: Build
run: |
haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp.git v4.3.69
pushd .
cd C:\hostedtoolcache\windows\haxe\${{env.haxe_version}}\x64\lib\hxcpp\git\tools\hxcpp
haxe compile.hxml
popd
haxelib install lime 8.2.2
haxelib install format
haxelib install hxp
haxelib install yaml
haxelib git lime-samples https://github.com/openfl/lime-samples
haxelib install openfl 9.4.1
haxelib run openfl setup
haxelib git feathersui https://github.com/feathersui/feathersui-openfl.git
haxelib git champaign https://github.com/Moonshine-IDE/Champaign.git
haxelib git mxhx-component https://github.com/mxhx-dev/mxhx-component.git
haxelib git mxhx-feathersui https://github.com/mxhx-dev/mxhx-feathersui.git
- name: List dependencies
run: haxelib list
- name: Build
if: ${{ !inputs.caching || !steps.cache-bin.outputs.cache-hit }}
shell: cmd
run: |
echo "Switching to drive X and building..."
X:
haxelib run openfl build project.xml windows ^
%haxe_flag% ^
-Dlogverbose ^
-Dlogcolor ^
-Dgitsha=${{ github.sha }} ^
-Dgitbranch=${{ github.ref_name }}
- name: Show Build
run: ls -r ${{ env.bin_path }}
- name: Upload bin
uses: actions/upload-artifact@v4
with:
name: ${{ env.app_name }}-windows-bin
path: ${{ env.bin_path }}
- name: Print NSIS version
run: makensis -version
- name: Create NSIS installer
run: >
makensis
/DPRODUCT_NAME=${{ env.app_name }}
/DPRODUCT_VERSION=${{ inputs.version }}
/DPRODUCT_PUBLISHER="Prominic.NET"
/DPRODUCT_WEB_SITE="/https://superhumaninstaller.com/"
/DBIN_PATH="${{ env.bin_path }}\*.*"
/DPRODUCT_EXE=${{ env.app_name }}.exe
/DPRODUCT_INSTALLER=${{ env.app_name }}-Setup.exe
/DROOT_KEY=HKCU
X:/Templates/installer/nsis-installer.nsi
- name: Sign installer
if: ${{ inputs.env == 'Production' }}
uses: Moonshine-IDE/[email protected]
with:
bin-path: Templates/installer/${{ env.app_name }}-Setup.exe
sm-host: ${{ secrets.SM_HOST }}
sm-api-key: ${{ secrets.SM_API_KEY }}
sm-client-cert-file-b64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
sm-client-cert-password: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
sm-code-signing-cert-sha1-hash: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: ${{ env.app_name }}-windows-installer
path: Templates/installer/${{ env.app_name }}-Setup.exe
if-no-files-found: error
- name: Copy files to choco
env:
choco_dir: ${{ inputs.env == 'Production' && 'chocolatey' || 'chocolatey-dev' }}
nupkg: ${{ inputs.env == 'Production' && 'superhumaninstaller*.nupkg' || 'superhumaninstallerdev*.nupkg' }}
run: |
cp Templates/installer/${{ env.app_name }}-Setup.exe Templates/${{ env.choco_dir }}/tools/
cp LICENSE.MD Templates/${{ env.choco_dir }}/
- name: Create chocko package
env:
choco_dir: ${{ inputs.env == 'Production' && 'chocolatey' || 'chocolatey-dev' }}
nupkg: ${{ inputs.env == 'Production' && 'superhumaninstaller*.nupkg' || 'superhumaninstallerdev*.nupkg' }}
run: |
choco pack `
--version ${{ inputs.version }} `
--out Templates/${{ env.choco_dir }}/ `
Templates/${{ env.choco_dir }}/${{ env.app_name }}.nuspec
mv `
.\Templates\${{ env.choco_dir }}\${{ env.nupkg }} `
.\Templates\${{ env.choco_dir }}\${{ env.app_name }}-Choco.nupkg
- name: Upload choco package
uses: actions/upload-artifact@v4
env:
choco_dir: ${{ inputs.env == 'Production' && 'chocolatey' || 'chocolatey-dev' }}
with:
name: ${{ env.app_name }}-Choco
path: Templates/${{ env.choco_dir }}/${{ env.app_name }}-Choco.nupkg