Skip to content

Commit

Permalink
WIP - Signing CD Action
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleenaylor committed Apr 17, 2024
1 parent fd0ea8a commit b4fefa1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 22 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
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 }}
Expand Down Expand Up @@ -38,15 +43,15 @@ jobs:
- 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@v3
with:
dotnet-version: |
2.1.x
3.1.x
5.0.x
dotnet-version:
8.0.x
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
Expand All @@ -62,26 +67,34 @@ jobs:
shell: cmd
run: msbuild build\FLExBridge.proj /t:Test

# All the following are used only when building an installer after a merge
- name: Install Latest Overcrowdin
shell: cmd
run: dotnet tool install -g overcrowdin
if: github.event_name != 'pull_request'
#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'
#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'
#if: github.event_name != 'pull_request'

- name: Build Installer
shell: cmd
run: msbuild build/FLExBridge.proj /t:Installer /p:UploadFolder=Alpha
if: github.event_name != 'pull_request'
run: msbuild build/FLExBridge.proj /t:CleanMasterOutputDir;PreparePublishingArtifactsInternal;BuildProductBaseMsi /p:UploadFolder=${{ inputs.environment || 'Alpha' }}
#if: github.event_name != 'pull_request'

- name: Create Msi Digest
uses: sillsdev/techops-ansible/generate-digest@gha-runner-test
with:
path: src/WiXInstaller/BaseInstallerBuild/*.msi
public-cert: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}
13 changes: 7 additions & 6 deletions build/TestInstallerBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ set Path=%WIX%\bin;%PATH%
echo Starting Build
pushd .
(
MSBuild FLExBridge.proj /t:RestoreBuildTasks;RestorePackages
REM MSBuild FLExBridge.proj /t:RestoreBuildTasks;RestorePackages
) && (
pushd ..\l10n
REM pushd ..\l10n
) && (
MSBuild l10n.proj /t:restore
REM MSBuild l10n.proj /t:restore
) && (
MSBuild l10n.proj /t:GetLatestL10ns
REM MSBuild l10n.proj /t:GetLatestL10ns
) && (
popd
REM popd
) && (
MSBuild FLExBridge.proj /target:Installer /p:Configuration=Debug /p:Platform="Any CPU" %*
MSBuild FLExBridge.proj /target:CleanMasterOutputDir;BuildProductBaseMsi /p:Configuration=Debug /p:Platform="Any CPU" %*
)
popd
REM -2147024893/0x80070003
34 changes: 29 additions & 5 deletions build/WixPatchableInstaller.targets
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
<AppBuildMasterDir>$(InstallersBaseDir)/$(SafeApplicationName)_Build_Master</AppBuildMasterDir>
<BinDirSuffix>objects/$(SafeApplicationName)</BinDirSuffix>
<DataDirSuffix>$(BinDirSuffix)_Data</DataDirSuffix>
<MsiFile>$(SafeApplicationName)_$(BuildVersion).msi</MsiFile>
<BaseBuildDir>$(RootDir)/src/WiXInstaller/BaseInstallerBuild</BaseBuildDir>
<BaseBuildArgs>"$(ApplicationName)" $(SafeApplicationName) $(BuildVersion) $(ProductIdGuid) $(UpgradeCodeGuid) "$(AppBuildDir)/$(BinDirSuffix)" "$(AppBuildDir)/$(DataDirSuffix)" $(CopyrightYear) "$(Manufacturer)" $(SafeManufacturer)</BaseBuildArgs>
</PropertyGroup>

<!-- Top Level Targets -->
Expand Down Expand Up @@ -184,14 +187,35 @@
</UsingTask>

<!-- Build Wix Product Targets -->
<Target Name="BuildProductBaseMsi" DependsOnTargets="GetDotNetFiles; InstallerVersionNumbers">

<!-- Attempt to build and sign the full installation package. Both the msi, and the Online and Offline bundles -->
<Target Name="BuildProductBase" DependsOnTargets="GetDotNetFiles; InstallerVersionNumbers">
<Exec WorkingDirectory="$(BaseBuildDir)" Command="buildBaseInstaller.bat $(BaseBuildArgs)" />

<ItemGroup>
<InstallerFiles Include="$(BaseBuildDir)/**/$(SafeApplicationName)_*.exe"/>
<InstallerFiles Include="$(BaseBuildDir)/**/$(SafeApplicationName)_*.msi"/>
</ItemGroup>
<Move SourceFiles="@(InstallerFiles)" DestinationFolder="$(InstallersBaseDir)"/>
<!-- The FieldWorks installer wants a stable installer name -->
<Move SourceFiles="$(InstallersBaseDir)/$(SafeApplicationName)_$(BuildVersion)_Offline.exe" DestinationFiles="$(InstallersBaseDir)/$(SafeApplicationName)_Offline.exe"/>
<Move SourceFiles="$(InstallersBaseDir)/$(SafeApplicationName)_$(BuildVersion)_Online.exe" DestinationFiles="$(InstallersBaseDir)/$(SafeApplicationName)_Online.exe"/>
<Move SourceFiles="$(InstallersBaseDir)/$(SafeApplicationName)_$(BuildVersion).msi" DestinationFiles="$(InstallersBaseDir)/$(SafeApplicationName).msi"/>
</Target>

<!-- Build the msi, useful for separating the signing step -->
<Target Name="BuildProductBaseMsi" DependsOnTargets="InstallerVersionNumbers">
<PropertyGroup>
<MsiFile>$(SafeApplicationName)_$(BuildVersion).msi</MsiFile>
<BaseBuildDir>$(RootDir)/src/WiXInstaller/BaseInstallerBuild</BaseBuildDir>
<BaseBuildArgs>"$(ApplicationName)" $(SafeApplicationName) $(BuildVersion) $(ProductIdGuid) $(UpgradeCodeGuid) "$(AppBuildDir)/$(BinDirSuffix)" "$(AppBuildDir)/$(DataDirSuffix)" $(CopyrightYear) "$(Manufacturer)" $(SafeManufacturer)</BaseBuildArgs>
<BuildArgsJIT>"$(ApplicationName)" $(SafeApplicationName) $(BuildVersion) $(ProductIdGuid) $(UpgradeCodeGuid) "$(AppBuildDir)/$(BinDirSuffix)" "$(AppBuildDir)/$(DataDirSuffix)" $(CopyrightYear) "$(Manufacturer)" $(SafeManufacturer)</BuildArgsJIT>
</PropertyGroup>
<Exec WorkingDirectory="$(BaseBuildDir)" Command="buildBaseInstaller.bat $(BaseBuildArgs)" />
<Exec WorkingDirectory="$(BaseBuildDir)" Command="buildMsi.bat $(BuildArgsJIT)" />
</Target>

<Target Name="BuildProductBaseBundles" DependsOnTargets="GetDotNetFiles; InstallerVersionNumbers" >
<PropertyGroup>
<BuildArgsJIT>"$(ApplicationName)" $(SafeApplicationName) $(BuildVersion) $(ProductIdGuid) $(UpgradeCodeGuid) "$(AppBuildDir)/$(BinDirSuffix)" "$(AppBuildDir)/$(DataDirSuffix)" $(CopyrightYear) "$(Manufacturer)" $(SafeManufacturer)</BuildArgsJIT>
</PropertyGroup>
<Exec WorkingDirectory="$(BaseBuildDir)" Command="buildexe.bat $(BuildArgsJIT)" />
<ItemGroup>
<InstallerFiles Include="$(BaseBuildDir)/**/$(SafeApplicationName)_*.exe"/>
<InstallerFiles Include="$(BaseBuildDir)/**/$(SafeApplicationName)_*.msi"/>
Expand Down
2 changes: 1 addition & 1 deletion l10n/l10n.proj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</Target>

<Target Name="FetchLatestL10ns" DependsOnTargets="restore">
<Exec Command="overcrowdin download -e -f $(FwL10nsZip)" />
<Exec Command="overcrowdin download -f $(FwL10nsZip)" />
</Target>

<Target Name="ProcessL10ns" DependsOnTargets="restore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="all" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="SIL.Chorus.LibChorus.TestUtilities" Version="$(ChorusVersion)" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.1.25" IncludeAssets="build" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.1.22" IncludeAssets="build" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit b4fefa1

Please sign in to comment.