workflow: fix nuget restore and add app package #69
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: MSBuild | |
on: [push] | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: ./UFCase.sln | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Release | |
BUILD_PLATFORM: x64 | |
jobs: | |
build: | |
runs-on: windows-2022 | |
# runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v1.0.3 | |
- name: Restore NuGet packages | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
nuget restore ./UFCase/packages.config -SolutionDirectory . | |
nuget restore ./UFCase.Host/packages.config -SolutionDirectory . | |
nuget restore ./UFCase.Host.Test/packages.config -SolutionDirectory . | |
# Decode the base 64 encoded pfx and save the Signing_Certificate | |
- name: Decode the pfx | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}") | |
$certificatePath = Join-Path -Path ./UFCase -ChildPath UFCase_TemporaryKey.pfx | |
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
# Create the app package by building and packaging the project | |
- name: Create the app package | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=${{ env.BUILD_PLATFORM }} /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=UFCase_TemporaryKey.pfx /p:PackageCertificatePassword="${{ secrets.PFX_KEY }}" /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true | |
env: | |
Appx_Bundle: Never | |
Appx_Package_Build_Mode: SideloadOnly | |
Appx_Package_Dir: AppPackages\ | |
Configuration: ${{ env.BUILD_CONFIGURATION }} | |
Platform: ${{ env.BUILD_PLATFORM }} | |
- name: Remove the pfx | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: Remove-Item -path ./UFCase/UFCase_TemporaryKey.pfx | |
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact | |
- name: Upload MSIX package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: MSIX Package | |
path: UFCase\AppPackages\ |