Merge pull request #100 from MicaApps/fix/package-path-crash #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mail Sideload Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}} | |
cancel-in-progress: true | |
jobs: | |
SideloadBuild: | |
runs-on: windows-latest | |
env: | |
AppxBundle: Always | |
AppxPackageBuildMode: SideloadOnly | |
Configuration: Release | |
ProjectName: MicaApps.Mail.UWP | |
CertThumbprint: C53D2D8CC27ACFF93AA2D54F8D6ADEE85C665F32 | |
SolutionPath: ${{github.workspace}}\Mail.sln | |
BuildSecretPath: ${{github.workspace}}\src\MicaApps.Mail.UWP\Secret.cs | |
CertificationPath: ${{github.workspace}}\Mail_SignCert.pfx | |
SideloadOutputPath: ${{github.workspace}}\Output\Sideload | |
TargetWindowsSDKVersion: 10.0.22621.1778 | |
TargetWindowsSDKInstallerUrl: https://download.microsoft.com/download/b/8/5/b85bd06f-491c-4c1c-923e-75ce2fe2378e/windowssdk/winsdksetup.exe | |
WindowsSDKBaseLocation: ${{github.workspace}}\WinSDK | |
WindowsSDKInstallerLocation: ${{github.workspace}}\WinSDK\winsdksetup.exe | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Install .NET Sdk | |
uses: actions/[email protected] | |
with: | |
dotnet-version: 7.x | |
- name: Setup MSBuild.exe | |
uses: microsoft/[email protected] | |
with: | |
msbuild-architecture: x64 | |
- name: Setup NuGet.exe | |
uses: NuGet/[email protected] | |
with: | |
nuget-version: latest | |
- name: Download And Install Latest Windows SDK As Requirement | |
run: | | |
try { | |
$CurrentSDKVersion = $(Get-Item "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0").GetValue("ProductVersion") | |
} catch { | |
$CurrentSDKVersion = '' | |
Write-Host "Detect the installed Windows SDK failed. Installed Windows SDK Version is aligned with TargetSDKVersion. Skipping this check" | |
} | |
if ($CurrentSDKVersion -ne '') { | |
if($CurrentSDKVersion -lt $env:TargetWindowsSDKVersion) { | |
New-Item -Path $env:WindowsSDKBaseLocation -ItemType Directory | |
Write-Host "Start downloading Windows SDK Installer using BitsTransfer..." | |
Start-BitsTransfer -Source $env:TargetWindowsSDKInstallerUrl -Destination $env:WindowsSDKInstallerLocation -Description "Downloading Windows SDK..." | |
Write-Host "Windows SDK Installer download completed" | |
Write-Host "Start installing Windows SDK..." | |
Start-Process $env:WindowsSDKInstallerLocation -ArgumentList "/q" -Wait | |
Write-Host "Windows SDK installed completed" | |
} else { | |
Write-Host "Windows SDK meet the requeirement, skipping this task and no need to install the SDK" | |
} | |
} | |
- name: Decode the SignCert | |
run: | | |
$pfxBase64 = [System.Convert]::FromBase64String("${{secrets.SIGNCERT}}") | |
[IO.File]::WriteAllBytes("$env:CertificationPath", $pfxBase64) | |
- name: Set Build Secret Value | |
run: | | |
$AADSecret = '${{secrets.AADSECRET}}' | |
$TargetContent = Get-Content -Path $env:BuildSecretPath | |
$TargetContent -Replace '<Mail-AAD-Secret-Value>', $AADSecret | Set-Content -Path $env:BuildSecretPath -Encoding UTF8 | |
- name: Restore the solution | |
run: nuget restore $env:SolutionPath | |
- name: Build the Sideload pacakge | |
run: msbuild $env:SolutionPath /nologo /nr:false /t:Clean /p:Configuration=$env:Configuration /t:Rebuild /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:AppxPackageBuildMode /p:AppxBundle=$env:AppxBundle /p:PackageCertificateKeyFile=$env:CertificationPath /p:PackageCertificatePassword=${{secrets.SIGNCERTPASSWORD}} /p:PackageCertificateThumbprint=$env:CertThumbprint /p:AppxPackageDir=${{env.SideloadOutputPath}}\ | |
env: | |
Platform: x64 | |
- name: Remove old artifacts | |
uses: c-hive/[email protected] | |
with: | |
age: 0 seconds | |
skip-recent: 1 | |
skip-tags: false | |
- name: Upload Sideload Artifacts | |
uses: actions/[email protected] | |
with: | |
name: Sideload Artifacts | |
path: ${{env.SideloadOutputPath}} |