Improve versioning in actions file #47
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: .NET Core Desktop | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] | |
runs-on: windows-latest | |
env: | |
Solution_Name: WpfMaiTouchEmulator.sln | |
Wap_Project_Directory: . | |
Wap_Project_Path: WpfMaiTouchEmulator.csproj | |
Build_Number: 1.6.0.${{ github.run_number }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v1.0.2 | |
# Restore the application to populate the obj folder with RuntimeIdentifiers | |
- name: Restore the application | |
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration | |
env: | |
Configuration: ${{ matrix.configuration }} | |
# Decode the base 64 encoded pfx and save the Signing_Certificate | |
- name: Decode the pfx | |
run: | | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") | |
$certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx | |
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
# Create the app package by building and packaging the Windows Application Packaging project | |
- name: Create the app package | |
run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} /p:Version=$env:Build_Number | |
env: | |
Appx_Bundle: Always | |
Appx_Bundle_Platforms: x86|x64 | |
Appx_Package_Build_Mode: StoreUpload | |
Configuration: ${{ matrix.configuration }} | |
- name: Build AIP | |
uses: caphyon/advinst-github-action@v2.0 | |
with: | |
advinst-version: '22.2' | |
advinst-enable-automation: 'true' | |
aip-path: ${{ github.workspace }}\Installer\Mai Touch Emulator.aip | |
aip-build-name: DefaultBuild | |
aip-package-name: installMaiTouchEmulator.msi | |
aip-output-dir: ${{ github.workspace }}\setup | |
aip-commands: | | |
SetProperty FOO="foo" | |
SetVersion $env:Build_Number | |
# Remove the pfx | |
- name: Remove the pfx | |
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MaiTouchEmulatorPortable | |
path: ./bin/Release/net8.0-windows10.0.17763.0/ | |
- name: Publish setup artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MaiTouchEmulatorInstaller | |
path: ./setup/installMaiTouchEmulator.msi |