ci: refactor msbuild workflow #182
Workflow file for this run
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: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
env: | |
SOLUTION_FILE_PATH: . # Path to the solution file relative to the root of the project. | |
BUILD_CONFIGURATION: Release # Configuration type to build. | |
jobs: | |
build: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore VCPKG packages | |
run: | | |
Invoke-WebRequest ` | |
-Uri "https://github.com/TheElixZammuto/moonlight-xbox/releases/download/1.10.0/vcpkg_installed.zip" ` | |
-OutFile .\vcpkg_installed.zip | |
- name: Extract VCPKG packages | |
run: Expand-Archive .\vcpkg_installed.zip -DestinationPath .\ | |
- name: List VCPKG packages | |
run: dir .\vcpkg_installed | |
- name: Install VCPKG packages | |
run: .\vcpkg\bootstrap-vcpkg.bat | |
- name: Build third party tools | |
run: .\generate-thirdparty-projects.bat | |
- name: Restore NuGet | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
- name: Load Certificate | |
env: | |
CERTIFICATE_FILE: ${{ secrets.CERTIFICATE_FILE }} | |
run: | | |
$encodedBytes = [System.Convert]::FromBase64String($env:CERTIFICATE_FILE); | |
Set-Content "cert.pfx" -Value $encodedBytes -AsByteStream; | |
Get-FileHash -Path "cert.pfx"; | |
- name: Build | |
# 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:AppxBundle=Always ` | |
/p:AppxPackageDir=output ` | |
/p:PackageCertificateKeyFile=cert.pfx ` | |
/p:UapAppxPackageBuildMode=SideLoadOnly ` | |
${{env.SOLUTION_FILE_PATH}} | |
- name: Clean Certificate | |
run: Remove-Item -path cert.pfx | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: moonlight-uwp | |
path: | | |
output |