|
1 | 1 | name: Base Installer |
2 | 2 | on: |
3 | 3 | push: |
4 | | - branches: ["release/9.3"] |
| 4 | + branches: ["release/9.3", "feature/gha-cd"] |
5 | 5 | workflow_dispatch: |
6 | 6 | inputs: |
7 | 7 | fw_ref: |
|
24 | 24 | description: 'Commit-ish for liblcm repository' |
25 | 25 | required: false |
26 | 26 | 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' |
27 | 31 |
|
28 | 32 | concurrency: |
29 | 33 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
|
38 | 42 | name: Build Debug and run Tests |
39 | 43 | runs-on: windows-latest |
40 | 44 | 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 | +
|
41 | 56 | - name: Checkout Files |
42 | 57 | uses: actions/checkout@v4 |
43 | 58 | id: checkout |
@@ -141,66 +156,90 @@ jobs: |
141 | 156 | exit 0 |
142 | 157 | } |
143 | 158 |
|
144 | | - - name: Find the versioned installer bundles |
145 | | - id: find_bundles |
| 159 | + - name: Move installers to staging folder |
| 160 | + id: stage_installers |
146 | 161 | shell: pwsh |
147 | | - working-directory: BuildDir |
148 | 162 | 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 |
156 | 180 |
|
157 | 181 | - name: Extract burn engines from bundles |
158 | 182 | shell: cmd |
159 | | - working-directory: BuildDir |
| 183 | + working-directory: Installers |
160 | 184 | 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 |
163 | 187 |
|
164 | 188 | - name: Sign Engines |
165 | 189 | if: github.event_name != 'pull_request' |
166 | 190 | uses: sillsdev/codesign/trusted-signing-action@v3 |
167 | 191 | 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/' |
173 | 197 |
|
174 | 198 | - name: Reattach Engines |
175 | 199 | if: github.event_name != 'pull_request' |
176 | | - working-directory: BuildDir |
| 200 | + working-directory: Installers |
177 | 201 | shell: cmd |
178 | 202 | 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 }}" |
181 | 205 |
|
182 | 206 | - name: Sign Bundles |
183 | 207 | if: github.event_name != 'pull_request' |
184 | 208 | uses: sillsdev/codesign/trusted-signing-action@v3 |
185 | 209 | 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 |
195 | 228 | 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 }} |
199 | 237 |
|
200 | 238 | - name: Upload Build Logs |
201 | 239 | uses: actions/upload-artifact@v4 |
202 | 240 | if: always() |
203 | 241 | with: |
| 242 | + if-no-files-found: warn |
204 | 243 | name: build-logs |
205 | 244 | path: | |
206 | 245 | Build/*.log |
|
0 commit comments