Skip to content

Commit 001dd61

Browse files
Store base installer artifacts in a github release
1 parent 6c31cf6 commit 001dd61

1 file changed

Lines changed: 73 additions & 34 deletions

File tree

.github/workflows/base-installer-cd.yml

Lines changed: 73 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Base Installer
22
on:
33
push:
4-
branches: ["release/9.3"]
4+
branches: ["release/9.3", "feature/gha-cd"]
55
workflow_dispatch:
66
inputs:
77
fw_ref:
@@ -24,6 +24,10 @@ on:
2424
description: 'Commit-ish for liblcm repository'
2525
required: false
2626
default: 'master'
27+
make_release:
28+
description: 'Should the build archive a release, false by default, should be set to true on a release build.'
29+
required: false
30+
default: 'false'
2731

2832
concurrency:
2933
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -38,6 +42,17 @@ jobs:
3842
name: Build Debug and run Tests
3943
runs-on: windows-latest
4044
steps:
45+
- name: Compute build number for archival
46+
id: build_number
47+
run: |
48+
$lastJenkins = 1097 # The last base build from jenkins
49+
$githubRun = $env:GITHUB_RUN_NUMBER
50+
$combined = $lastJenkins + $githubRun
51+
echo "Last Jenkins build: $lastJenkins"
52+
echo "GitHub run number: $githubRun"
53+
echo "Combined build number: $combined"
54+
echo "RELEASE_BASE_BUILD_NUMBER=$combined" >> $env:GITHUB_ENV
55+
4156
- name: Checkout Files
4257
uses: actions/checkout@v4
4358
id: checkout
@@ -141,66 +156,90 @@ jobs:
141156
exit 0
142157
}
143158
144-
- name: Find the versioned installer bundles
145-
id: find_bundles
159+
- name: Move installers to staging folder
160+
id: stage_installers
146161
shell: pwsh
147-
working-directory: BuildDir
148162
run: |
149-
Get-ChildItem -Path .
150-
$offlineExe = Get-ChildItem -Path . -Filter "FieldWorks_*_Offline_x64.exe" | Select-Object -First 1
151-
$onlineExe = Get-ChildItem -Path . -Filter "FieldWorks_*_Online_x64.exe" | Select-Object -First 1
152-
if (-not $offlineExe) { throw "FieldWorks_VERSION_Offline_x64.exe not found in BuildDir" }
153-
if (-not $onlineExe) { throw "FieldWorks_VERSION_Online_x64.exe not found in BuildDir" }
154-
echo "offline_exe=$($offlineExe.FullName)" >> $env:GITHUB_OUTPUT
155-
echo "online_exe=$($onlineExe.FullName)" >> $env:GITHUB_OUTPUT
163+
$staging = Join-Path $pwd "Installers"
164+
if (-not (Test-Path $staging)) { New-Item -ItemType Directory -Path $staging | Out-Null }
165+
166+
$offlineExe = Get-ChildItem -Path BuildDir -Filter "FieldWorks_*_Offline_x64.exe" | Select-Object -First 1
167+
$onlineExe = Get-ChildItem -Path BuildDir -Filter "FieldWorks_*_Online_x64.exe" | Select-Object -First 1
168+
169+
if (-not $offlineExe) { throw "FieldWorks_VERSION_Offline_x64.exe not found in BuildDir" }
170+
if (-not $onlineExe) { throw "FieldWorks_VERSION_Online_x64.exe not found in BuildDir" }
171+
172+
Move-Item -Path $offlineExe.FullName -Destination $staging
173+
Move-Item -Path $onlineExe.FullName -Destination $staging
174+
175+
$offlinePath = Join-Path $staging $offlineExe.Name
176+
$onlinePath = Join-Path $staging $onlineExe.Name
177+
178+
"offline_exe=$offlinePath" >> $env:GITHUB_OUTPUT
179+
"online_exe=$onlinePath" >> $env:GITHUB_OUTPUT
156180
157181
- name: Extract burn engines from bundles
158182
shell: cmd
159-
working-directory: BuildDir
183+
working-directory: Installers
160184
run: |
161-
insignia -ib "${{ steps.find_bundles.outputs.offline_exe }}" -o offline-engine.exe
162-
insignia -ib "${{ steps.find_bundles.outputs.online_exe }}" -o online-engine.exe
185+
insignia -ib "${{ steps.stage_installers.outputs.offline_exe }}" -o offline-engine.exe
186+
insignia -ib "${{ steps.stage_installers.outputs.online_exe }}" -o online-engine.exe
163187
164188
- name: Sign Engines
165189
if: github.event_name != 'pull_request'
166190
uses: sillsdev/codesign/trusted-signing-action@v3
167191
with:
168-
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
169-
files-folder: BuildDir
170-
files-folder-filter: '*-engine.exe'
171-
description: 'FieldWorks Installer'
172-
description-url: 'https://software.sil.org/fieldworks/'
192+
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
193+
files-folder: Installers
194+
files-folder-filter: '*-engine.exe'
195+
description: 'FieldWorks Installer'
196+
description-url: 'https://software.sil.org/fieldworks/'
173197

174198
- name: Reattach Engines
175199
if: github.event_name != 'pull_request'
176-
working-directory: BuildDir
200+
working-directory: Installers
177201
shell: cmd
178202
run: |
179-
insignia -ab online-engine.exe "${{ steps.find_bundles.outputs.offline_exe }}" -o "${{ steps.find_bundles.outputs.offline_exe }}"
180-
insignia -ab offline-engine.exe "${{ steps.find_bundles.outputs.offline_exe }}" -o "${{ steps.find_bundles.outputs.offline_exe }}"
203+
insignia -ab online-engine.exe "${{ steps.stage_installers.outputs.offline_exe }}" -o "${{ steps.stage_installers.outputs.offline_exe }}"
204+
insignia -ab offline-engine.exe "${{ steps.stage_installers.outputs.online_exe }}" -o "${{ steps.stage_installers.outputs.online_exe }}"
181205
182206
- name: Sign Bundles
183207
if: github.event_name != 'pull_request'
184208
uses: sillsdev/codesign/trusted-signing-action@v3
185209
with:
186-
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
187-
files-folder: BuildDir
188-
files-folder-filter: FieldWorks_*.exe
189-
description: 'FieldWorks Installer'
190-
description-url: 'https://software.sil.org/fieldworks/'
191-
192-
- name: Upload Signed Installers
193-
uses: actions/upload-artifact@v4
194-
if: github.event_name != 'pull_request'
210+
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
211+
files-folder: Installers
212+
files-folder-filter: FieldWorks_*.exe
213+
description: 'FieldWorks Installer'
214+
description-url: 'https://software.sil.org/fieldworks/'
215+
216+
- name: Compress Build Artifacts
217+
if: ${{ inputs.make_release == 'true' }}
218+
run: |
219+
[System.IO.Compression.ZipFile]::CreateFromDirectory(
220+
"$pwd\BuildDir",
221+
"$pwd\BuildDir.zip",
222+
[System.IO.Compression.CompressionLevel]::Optimal,
223+
$false
224+
)
225+
226+
- name: Create Release and Upload artifacts
227+
uses: softprops/action-gh-release@v1
195228
with:
196-
name: FieldWorks-Installers
197-
path: BuildDir/FieldWorks_*.exe
198-
if-no-files-found: warn
229+
tag_name: build-${{ github.run_number }}
230+
name: "FieldWorks Base Build #${{ github.run_number }}"
231+
draft: false
232+
prerelease: true
233+
files: |
234+
${{ github.workspace }}\BuildDir.zip
235+
${{ steps.stage_installers.outputs.offline_exe }}
236+
${{ steps.stage_installers.outputs.online_exe }}
199237
200238
- name: Upload Build Logs
201239
uses: actions/upload-artifact@v4
202240
if: always()
203241
with:
242+
if-no-files-found: warn
204243
name: build-logs
205244
path: |
206245
Build/*.log

0 commit comments

Comments
 (0)