From 0f6542ff59dd9a69dbba19f38540de3673912a05 Mon Sep 17 00:00:00 2001 From: Adam McLellan Date: Mon, 9 Dec 2024 07:27:26 -0400 Subject: [PATCH] Create dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 74 +++++++++++++++++++ .gitignore | 2 +- .../PublishProfiles/win-arm64.pubxml | 14 ++++ .../Properties/PublishProfiles/win-x64.pubxml | 14 ++++ .../Properties/PublishProfiles/win-x86.pubxml | 14 ++++ .../PublishProfiles/FolderProfile.pubxml | 19 +++++ 6 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dotnet-desktop.yml create mode 100644 OctaLibApp/Properties/PublishProfiles/win-arm64.pubxml create mode 100644 OctaLibApp/Properties/PublishProfiles/win-x64.pubxml create mode 100644 OctaLibApp/Properties/PublishProfiles/win-x86.pubxml create mode 100644 OctaLibConsole/Properties/PublishProfiles/FolderProfile.pubxml diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml new file mode 100644 index 0000000..37ac053 --- /dev/null +++ b/.github/workflows/dotnet-desktop.yml @@ -0,0 +1,74 @@ +# This workflow will build, sign, and package a WinUI 3 MSIX desktop application +# built on .NET. + +name: WinUI 3 MSIX app + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Release] + + runs-on: windows-latest # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + + env: + Solution_Name: OctaLib.sln + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v4.1.0 + with: + dotnet-version: 8.0.x + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.3.3 + + # 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 + 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 = "GitHubActionsWorkflow.pfx" + [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) + + # Create the app package by building and packaging the project + - name: Create the app package + run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true + env: + Appx_Bundle: Never + Appx_Package_Build_Mode: SideloadOnly + Appx_Package_Dir: Packages\ + Configuration: ${{ matrix.configuration }} + Platform: ${{ matrix.platform }} + + # Remove the pfx + - name: Remove the pfx + run: Remove-Item -path GitHubActionsWorkflow.pfx + + # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact + - name: Upload MSIX package + uses: actions/upload-artifact@v4 + with: + name: MSIX Package + path: OctaLibApp\Packages diff --git a/.gitignore b/.gitignore index a0091fd..d4ca6c8 100644 --- a/.gitignore +++ b/.gitignore @@ -186,7 +186,7 @@ publish/ *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted -*.pubxml +#*.pubxml *.publishproj # Microsoft Azure Web App publish settings. Comment the next line if you want to diff --git a/OctaLibApp/Properties/PublishProfiles/win-arm64.pubxml b/OctaLibApp/Properties/PublishProfiles/win-arm64.pubxml new file mode 100644 index 0000000..8953cce --- /dev/null +++ b/OctaLibApp/Properties/PublishProfiles/win-arm64.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + ARM64 + win-arm64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + + \ No newline at end of file diff --git a/OctaLibApp/Properties/PublishProfiles/win-x64.pubxml b/OctaLibApp/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 0000000..cd99561 --- /dev/null +++ b/OctaLibApp/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + + \ No newline at end of file diff --git a/OctaLibApp/Properties/PublishProfiles/win-x86.pubxml b/OctaLibApp/Properties/PublishProfiles/win-x86.pubxml new file mode 100644 index 0000000..a70c694 --- /dev/null +++ b/OctaLibApp/Properties/PublishProfiles/win-x86.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + x86 + win-x86 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + + \ No newline at end of file diff --git a/OctaLibConsole/Properties/PublishProfiles/FolderProfile.pubxml b/OctaLibConsole/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..5d002da --- /dev/null +++ b/OctaLibConsole/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,19 @@ + + + + + Release + Any CPU + bin\Release\net8.0\publish\win-x86\ + FileSystem + <_TargetId>Folder + net8.0 + win-x86 + true + false + false + false + + \ No newline at end of file