Skip to content

Instantly share code, notes, and snippets.

@Sweekriti91
Created December 6, 2021 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sweekriti91/0af13d4d36685ea646233a52fb4aea5b to your computer and use it in GitHub Desktop.
Save Sweekriti91/0af13d4d36685ea646233a52fb4aea5b to your computer and use it in GitHub Desktop.
Dev Pipeline for MAUI WinUI App
name: Build Windows Desktop
# https://github.com/actions/virtual-environments
on:
push:
branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch:
env:
DOTNETVERSION: 6.0.100
jobs:
buildwindows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK 6.0.100
uses: actions/setup-dotnet@v1
with:
dotnet-version: '${{env.DOTNETVERSION}}'
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
vs-prerelease: true
- name: Install .NET MAUI
shell: pwsh
run: |
& dotnet --version
& dotnet nuget locals all --clear
& dotnet workload install maui --from-rollback-file https://aka.ms/dotnet/maui/preview.10.json --source https://aka.ms/dotnet6/nuget/index.json --source https://api.nuget.org/v3/index.json
& dotnet workload install android ios maccatalyst tvos macos maui wasm-tools --from-rollback-file https://aka.ms/dotnet/maui/preview.10.json --source https://aka.ms/dotnet6/nuget/index.json --source https://api.nuget.org/v3/index.json
- name: Restore nuget packages
run: dotnet restore <YOUR_APP>.sln
- name: Build WinUI3
run: msbuild <YOUR_APP>.sln -restore -p:Configuration=Release
- name: Create signing pfx file from secrets
shell: pwsh
id: secret-file
env:
SECRET_DATA1: ${{ secrets.WIN_SIGN_CERT }}
run: |
$secretFile = "XamCATFidCert.pfx";
$encodedBytes = [System.Convert]::FromBase64String($env:SECRET_DATA1);
Set-Content $secretFile -Value $encodedBytes -AsByteStream;
Write-Output "::set-output name=SECRET_FILE::$secretFile";
Write-Output " ";
Write-Output "CHECK FILE EXISTS";
Write-Output " ";
ls
- name: Pack Windows App
shell: pwsh
run: |
& "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx" pack /v /h SHA256 /d "FidelityAtpNextGen\bin\Release\net6.0-windows10.0.19041\win-x64" /p <APP_NAME>.msix
& ls
- name: Sign Windows App
shell: pwsh
env:
CERT_PASSWORD: ${{ secrets.WIN_CERT_PASSWORD }}
run: |
& "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\SignTool" sign /a /fd SHA256 /f XamCATFidCert.pfx /p abcd1234 <APP_NAME>.msix
- name: Distribute to App Center
shell: bash
env:
APPCENTER_TOKEN: ${{ secrets.APP_CENTER_TOKEN }}
run: |
npm install -g appcenter-cli
appcenter distribute release --file <APP_NAME>.msix --release-notes "Release from GitHub Actions" --group <YOUR_TESTER_GROUP> --app <APP CENTER ORG>/<APP CENTER APP NAME> --build-version 1.0.0.0 --build-number $GITHUB_RUN_NUMBER --token $APPCENTER_TOKEN
- uses: actions/upload-artifact@v2
if: ${{ false }}
with:
name: artifacts-windows
path: |
*.msix
- name: Delete secret file
run: |
Remove-Item -Path $env:SECRET_FILE;
shell: pwsh
if: always()
env:
SECRET_FILE: ${{ steps.secret-file.outputs.SECRET_FILE }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment