Skip to content

Commit

Permalink
workflow: fix nuget restore and add app package
Browse files Browse the repository at this point in the history
  • Loading branch information
seven-mile committed Sep 16, 2023
1 parent 6d828dc commit cefe582
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on: [push]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: ./UFCase.sln
PKG_CONFIG_FILE_PATH: ./UFCase/packages.config

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
Expand All @@ -23,15 +22,40 @@ jobs:

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.3
with:
vs-prerelease: true

- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.PKG_CONFIG_FILE_PATH}} -SolutionDirectory .
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)
- name: Build
# Create the app package by building and packaging the project
- name: Create the app package
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}
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\

0 comments on commit cefe582

Please sign in to comment.