Skip to content

RepositoryUtility work & CI/CD refactor #305

RepositoryUtility work & CI/CD refactor

RepositoryUtility work & CI/CD refactor #305

Workflow file for this run

name: FlexBridge CI/CD
on:
push:
branches: ["develop", "master"]
pull_request:
branches: ["develop", "master"]
workflow_dispatch:
inputs:
releaseType:
description: 'Alpha, Beta, Stable used to stamp release artifacts'
required: true
default: 'Alpha'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
FILESTOSIGNLATER: "${{ github.workspace }}\\filesToSign"
teamcity_build_checkoutDir: ${{ github.workspace }}
name: Build Debug / Test / Build Msi
runs-on: windows-latest
steps:
- name: Checkout Files
uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
submodules: true
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
# We need the dotnet runtime to execute overcrowdin
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version:
8.0.x
if: github.event_name != 'pull_request'
- name: Downgrade Wix Toolset - remove when runner has 3.14.2
run: |
choco uninstall wixtoolset
choco install wixtoolset --version 3.11.2 --allow-downgrade --force
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: github.event_name != 'pull_request'
# If we are just doing a CI build we don't need real localizations, but the location must exist
- name: Add Fake Localizations for CI
shell: bash
run: echo > DistFiles/localizations/empty.xlf
if: github.event_name == 'pull_request'
- name: Install Latest Overcrowdin
shell: cmd
run: dotnet tool install -g overcrowdin
if: github.event_name != 'pull_request'
- name: Restore L10n Packages
shell: cmd
run: |
cd l10n
msbuild l10n.proj /t:restore
if: github.event_name != 'pull_request'
- name: Get Latest L10ns
shell: cmd
run: |
cd l10n
msbuild l10n.proj /t:GetLatestL10ns;CopyL10nsToDistFiles
if: github.event_name != 'pull_request'
- name: Restore Build Tasks & Packages
id: package_restore
shell: cmd
run: msbuild build\FLExBridge.proj /t:RestoreBuildTasks;RestorePackages
- name: Build & Test
id: build_and_test_step
shell: cmd
run: msbuild build\FLExBridge.proj /t:Test /p:Configuration=Release
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
with:
files: '**/*TestResults.trx'
- name: Create NuGet packages
shell: cmd
run: msbuild build\FLExBridge.proj /t:Pack /p:Configuration=Release
- name: Upload NuGet packages to build artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: output/*nupkg
if-no-files-found: warn
# --skip-duplicate allows retrying a workflow that failed with a partial push, skipping already published packages and publishing the rest.
- name: Publish NuGet packages to nuget.org
run: |
foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *nupkg)) {
dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json
}
env:
NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }}
if: github.event_name != 'pull_request'
continue-on-error: true
# All the following are used only when building an installer after a merge
- name: Build Msi
if: github.event_name != 'pull_request'
id: build_msi
shell: cmd
run: |
msbuild build/FLExBridge.proj /t:CleanMasterOutputDir;PreparePublishingArtifactsInternal;BuildProductBaseMsi /p:UploadFolder=${{ inputs.environment || 'Alpha' }}
- name: Sign FlexBridge msi
uses: sillsdev/codesign/trusted-signing-action@v3
if: github.event_name != 'pull_request'
with:
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
files-folder: src/WiXInstaller/BaseInstallerBuild
files-folder-filter: FlexBridge*.msi
description: 'FLExBridge installer - SIL Global'
description-url: 'https://software.sil.org/fieldworks/help/using-sendreceive/flex-bridge/'
- name: Build Bundles
id: build_bundles
if: github.event_name != 'pull_request'
working-directory: build
shell: cmd
run: |
msbuild FLExBridge.proj /t:RestoreBuildTasks;RestorePackages;GetDotNetFiles;CopyWixOverrides
msbuild FLExBridge.proj /t:BuildProductBaseBundles /p:Configuration=Release /p:Platform="Any CPU"
- name: Extract burn engines
id: extract_engines
if: github.event_name != 'pull_request'
working-directory: BuildDir
shell: cmd
run: |
insignia -ib FlexBridge_Offline.exe -o offline-engine.exe
insignia -ib FlexBridge_Online.exe -o online-engine.exe
- name: Sign Engines
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/trusted-signing-action@v3
with:
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
files-folder: BuildDir
files-folder-filter: '*-engine.exe'
description: 'FLExBridge installer burn engine - SIL Global'
description-url: 'https://software.sil.org/fieldworks/help/using-sendreceive/flex-bridge/'
- name: Reattach Engines
if: github.event_name != 'pull_request'
working-directory: BuildDir
shell: cmd
run: |
insignia -ab online-engine.exe FlexBridge_Online.exe -o FlexBridge_Online.exe
insignia -ab offline-engine.exe FlexBridge_Offline.exe -o FlexBridge_Offline.exe
- name: Sign Bundles
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/trusted-signing-action@v3
with:
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
files-folder: BuildDir
files-folder-filter: FlexBridge_*.exe
description: 'FLExBridge installer - SIL Global'
description-url: 'https://software.sil.org/fieldworks/help/using-sendreceive/flex-bridge/'
- name: Upload Signed Installers
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
with:
name: FlexBridgeInstallers
path: BuildDir/FlexBridge_*.exe
if-no-files-found: warn