diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c7cab73..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: dotnet package - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - dotnet-version: ['7.0', '3.1.x', '5.0.x' ] - - steps: - - uses: actions/checkout@v3 - - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ matrix.dotnet-version }} - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore - - name: Test - run: dotnet test --no-restore --verbosity normal \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..614d138 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,115 @@ +name: cd + +on: + push: + # tags: + # - '*' + +jobs: + build: + + runs-on: windows-latest + strategy: + matrix: + dotnet-version: ['7.0'] + channel: [ Dev, Prod_Sideload, Prod_Store ] + targetPlatform: [ Any CPU ] + include: + + # includes the following variables for the matrix leg matching Dev + - channel: Dev + ChannelName: Dev + Configuration: Debug + #DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-dev + MsixPackageId: ElevenPercent.Dev + MsixPublisherId: CN=jmorjsm + MsixPackageDisplayName: ElevenPercent (Dev) + + # includes the following variables for the matrix leg matching Prod_Sideload + - channel: Prod_Sideload + Configuration: Release + ChannelName: Prod_Sideload + #DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-prod + MsixPackageId: ElevenPercent.ProdSideload + MsixPublisherId: CN=jmorjsm + MsixPackageDisplayName: ElevenPercent (ProdSideload) + + # includes the following variables for the matrix leg matching Prod_Store + - channel: Prod_Store + Configuration: Release + ChannelName: Prod_Store + DistributionUrl: + MsixPackageId: ElevenPercent.ProdStore + MsixPublisherId: CN=jmorjsm + MsixPackageDisplayName: ElevenPercent (ProdStore) + + steps: # Update the appxmanifest before build by setting the per-channel values set in the matrix. + - uses: actions/checkout@v3 + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.201 + +# - name: Update manifest version +# run: | +# [xml]$manifest = get-content ".\$env:Wap_Project_Directory\Package.appxmanifest" +# $manifest.Package.Identity.Version = "$env:NBGV_SimpleVersion.0" +# $manifest.Package.Identity.Name = "${{ matrix.MsixPackageId }}" +# $manifest.Package.Identity.Publisher = "${{ matrix.MsixPublisherId }}" +# $manifest.Package.Properties.DisplayName = "${{ matrix.MsixPackageDisplayName }}" +# $manifest.Package.Applications.Application.VisualElements.DisplayName = "${{ matrix.MsixPackageDisplayName }}" +# $manifest.save(".\$env:Wap_Project_Directory\Package.appxmanifest") + + - name: Set env variables + run : | + "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $env:GITHUB_ENV + + # Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.0 + + # Restore the application + - name: Restore the application to populate the obj folder + run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: Debug + + # Build the Windows Application Packaging project for Dev and Prod_Sideload + - name: Build the Windows Application Packaging Project (wapproj) for ${{ matrix.ChannelName }} + run: msbuild $env:Solution_Path /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:BuildMode # /p:AppxBundle=$env:AppxBundle /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} + if: matrix.ChannelName != 'Prod_Store' + env: + AppxBundle: Never + AppInstallerUri: ${{ matrix.DistributionUrl }} + BuildMode: SideLoadOnly + Configuration: ${{ matrix.Configuration }} + GenerateAppInstallerFile: True + TargetPlatform: ${{ matrix.targetplatform }} + + # Build the Windows Application Packaging project for Prod_Store + - name: Build the Windows Application Packaging Project (wapproj) for ${{ matrix.ChannelName }} + run: msbuild $env:Solution_Path /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:BuildMode # /p:AppxBundle=$env:AppxBundle /p:GenerateAppInstallerFile=$env:GenerateAppInstallerFile /p:AppxPackageSigningEnabled=$env:AppxPackageSigningEnabled + if: matrix.ChannelName == 'Prod_Store' + env: + AppxBundle: Never + AppxPackageSigningEnabled: False + BuildMode: StoreOnly + Configuration: ${{ matrix.Configuration }} + GenerateAppInstallerFile: False + TargetPlatform: ${{ matrix.targetplatform }} + + - name: tree + run : | + tree . + + - name: zip + run: | + Compress-Archive -DestinationPath Eleven-Percent.zip -Path Eleven-Percent\bin\${{matrix.Configuration}}\net7.0-windows\ + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: ElevenPercent.zip diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d0749b9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: ci + +on: [push] + +jobs: + build: + runs-on: windows-latest + env: + Solution_Path: eleven-percent.sln + #Test_Project_Path: MyWpfApp.Tests\MyWpfApp.Tests.csproj + Wpf_Project_Path: eleven-percent\eleven-percent.csproj + Wap_Project_Directory: ElevenPercent.Package + Wap_Project_Name: ElevenPercent.Package.wapproj + strategy: + matrix: + dotnet-version: ['7.0'] + channel: [ Dev, Prod_Sideload, Prod_Store ] + targetPlatform: [ Any CPU ] + include: + + # includes the following variables for the matrix leg matching Dev + - channel: Dev + ChannelName: Dev + Configuration: Debug + #DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-dev + MsixPackageId: ElevenPercent.Dev + MsixPublisherId: CN=jmorjsm + MsixPackageDisplayName: ElevenPercent (Dev) + + # includes the following variables for the matrix leg matching Prod_Sideload + - channel: Prod_Sideload + Configuration: Release + ChannelName: Prod_Sideload + #DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-prod + MsixPackageId: ElevenPercent.ProdSideload + MsixPublisherId: CN=jmorjsm + MsixPackageDisplayName: ElevenPercent (ProdSideload) + + # includes the following variables for the matrix leg matching Prod_Store + - channel: Prod_Store + Configuration: Release + ChannelName: Prod_Store + DistributionUrl: + MsixPackageId: ElevenPercent.ProdStore + MsixPublisherId: CN=jmorjsm + MsixPackageDisplayName: ElevenPercent (ProdStore) + + steps: + - uses: actions/checkout@v3 + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.201 + + - name: Set env variables + run : | + "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $env:GITHUB_ENV + + # Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.0 + + # Restore the application + - name: Restore the application to populate the obj folder + run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: Debug + + # Build the Windows Application Packaging project + - name: Build the Windows Application Packaging Project (wapproj) + run: msbuild $env:Solution_Path /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration # /p:UapAppxPackageBuildMode=$env:BuildMode /p:AppxBundle=$env:AppxBundle # /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} + env: + AppxBundle: Never + BuildMode: SideLoadOnly + Configuration: Release + TargetPlatform: ${{ matrix.targetplatform }} + + - name: tree + run : | + tree . + # Upload the MSIX package: https://github.com/marketplace/actions/upload-artifact + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: MSIX Package + path: ElevenPercent\bin\Release\net7.0-windows\eleven-percent.dll