Merge pull request #219 from jetelain/fix-building-detection #68
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 Windows | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] | |
runs-on: windows-latest | |
env: | |
Solution_Name: ArmaRealMap.sln | |
Test_Project_Path: GameRealisticMap.Studio.Test\GameRealisticMap.Studio.Test.csproj | |
Wap_Project_Directory: GameRealisticMap.Studio.Package | |
Wap_Project_Path: GameRealisticMap.Studio.Package\GameRealisticMap.Studio.Package.wapproj | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v2 | |
# Execute all unit tests in the solution | |
- name: Execute unit tests | |
run: dotnet test $env:Test_Project_Path | |
# 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 /p:Platform=x64 /p:RuntimeIdentifiers=win-x64 | |
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:Platform=x64 | |
env: | |
Appx_Bundle: Always | |
Appx_Package_Build_Mode: StoreUpload | |
Configuration: ${{ matrix.configuration }} | |
# Remove the pfx | |
- name: Remove the pfx | |
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx | |
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact | |
- name: Upload MSIX Test Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MSIX Test Package | |
path: ${{ env.Wap_Project_Directory }}\AppPackages\*_Test | |
#- name: Upload Appx Upload | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: APPX Upload | |
# path: ${{ env.Wap_Project_Directory }}\AppPackages\*.appxupload | |