From 6f7929f0f46e3bb6d931296e402e38b903231548 Mon Sep 17 00:00:00 2001 From: David Johnson Date: Thu, 12 Jun 2025 09:29:00 +0100 Subject: [PATCH 1/6] Add permissions and trigger on fix branches --- .github/workflows/dotnet-desktop.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 640d8ee..c274516 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -15,7 +15,12 @@ on: push: branches: [ "main" ] pull_request: - branches: [ "main" ] + branches: [ "main", "fix/*" ] + +permissions: + contents: write + packages: write + jobs: @@ -149,7 +154,7 @@ jobs: Commit: ${{ github.sha }} Release package (ZIP) attached. This ZIP contains the application bundle and an install.ps1 script for installing the self-signed certificate and the application. draft: false - prerelease: false + prerelease: true allowUpdates: true # Upload the ZIP package as a release asset From 555c08004bb5a0b15584cc3e3e6c38d69db63b7b Mon Sep 17 00:00:00 2001 From: David Johnson Date: Thu, 12 Jun 2025 20:01:32 +0100 Subject: [PATCH 2/6] Enhance GitHub Actions workflow to trigger on fix branches and adjust release conditions accordingly --- .github/workflows/dotnet-desktop.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index c274516..c7a0b89 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -13,7 +13,9 @@ name: .NET Core Desktop on: push: - branches: [ "main" ] + branches: + - "main" + - "fix/*" # Add this to trigger on pushes to fix/* branches pull_request: branches: [ "main", "fix/*" ] @@ -99,7 +101,7 @@ jobs: # Set Date-Based Version for the Release (Moved Up) - name: Set Date-Based Version id: version_generator - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) shell: pwsh run: | $version = (Get-Date -Format "yyyy.MM.dd") + ".${{ github.run_number }}" @@ -143,7 +145,7 @@ jobs: - name: Create Release id: create_release uses: ncipollo/release-action@v1 - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.version_generator.outputs.version_number != '' && steps.create_zip_package.outputs.zip_path != '' + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) && steps.version_generator.outputs.version_number != '' && steps.create_zip_package.outputs.zip_path != '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -153,8 +155,8 @@ jobs: Automated release v${{ steps.version_generator.outputs.version_number }}. Commit: ${{ github.sha }} Release package (ZIP) attached. This ZIP contains the application bundle and an install.ps1 script for installing the self-signed certificate and the application. - draft: false - prerelease: true + draft: ${{ startsWith(github.ref, 'refs/heads/fix/') }} + prerelease: ${{ startsWith(github.ref, 'refs/heads/fix/') }} allowUpdates: true # Upload the ZIP package as a release asset From e1b131737fa888db1a4a0397807c6d5520b07407 Mon Sep 17 00:00:00 2001 From: David Johnson <13346199+Cirzen@users.noreply.github.com> Date: Thu, 12 Jun 2025 20:39:11 +0100 Subject: [PATCH 3/6] Update dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index c7a0b89..5ee3dc1 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -9,21 +9,19 @@ # refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework # -name: .NET Core Desktop +name: Sideload on: push: branches: - "main" - - "fix/*" # Add this to trigger on pushes to fix/* branches pull_request: branches: [ "main", "fix/*" ] permissions: contents: write packages: write - - + jobs: build: @@ -111,7 +109,7 @@ jobs: # New Step: Create Release ZIP Package - name: Create Release ZIP Package id: create_zip_package - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) shell: pwsh run: | $appPackagesDir = "${{ env.Wap_Project_Directory }}\AppPackages" From c4deaa25f401a31b9e2804e2dfbee21c4c4ecfb9 Mon Sep 17 00:00:00 2001 From: David Johnson <13346199+Cirzen@users.noreply.github.com> Date: Thu, 12 Jun 2025 21:08:47 +0100 Subject: [PATCH 4/6] Update dotnet-desktop.yml --- .github/workflows/dotnet-desktop.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 5ee3dc1..9b35bde 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -99,7 +99,7 @@ jobs: # Set Date-Based Version for the Release (Moved Up) - name: Set Date-Based Version id: version_generator - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) + if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) shell: pwsh run: | $version = (Get-Date -Format "yyyy.MM.dd") + ".${{ github.run_number }}" @@ -109,7 +109,7 @@ jobs: # New Step: Create Release ZIP Package - name: Create Release ZIP Package id: create_zip_package - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) + if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) shell: pwsh run: | $appPackagesDir = "${{ env.Wap_Project_Directory }}\AppPackages" @@ -143,7 +143,7 @@ jobs: - name: Create Release id: create_release uses: ncipollo/release-action@v1 - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) && steps.version_generator.outputs.version_number != '' && steps.create_zip_package.outputs.zip_path != '' + if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) && steps.version_generator.outputs.version_number != '' && steps.create_zip_package.outputs.zip_path != '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -160,7 +160,7 @@ jobs: # Upload the ZIP package as a release asset - name: Upload Release Asset (ZIP Package) uses: actions/upload-release-asset@v1 - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.create_zip_package.outputs.zip_path != '' && steps.create_release.outputs.upload_url != '' + if: steps.create_zip_package.outputs.zip_path != '' && steps.create_release.outputs.upload_url != '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 53f18ed1c7a4da5bbe43245799e79d54efa67231 Mon Sep 17 00:00:00 2001 From: David Johnson <13346199+Cirzen@users.noreply.github.com> Date: Thu, 12 Jun 2025 21:27:45 +0100 Subject: [PATCH 5/6] Add debug step to work out why later steps not executing --- .github/workflows/dotnet-desktop.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 9b35bde..534b1d8 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -96,7 +96,14 @@ jobs: run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx -Force if: ${{ steps.decode_pfx.outcome == 'success' }} - # Set Date-Based Version for the Release (Moved Up) + # Debug event name and ref + - name: Debug GitHub Context + shell: pwsh + run: | + Write-Host "github.event_name: ${{ github.event_name }}" + Write-Host "github.ref: ${{ github.ref }}" + + # Set Date-Based Version for the Release - name: Set Date-Based Version id: version_generator if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) From e43048138b3d8bd0ab6f7002eeea3fe46b9bb593 Mon Sep 17 00:00:00 2001 From: David Johnson <13346199+Cirzen@users.noreply.github.com> Date: Thu, 12 Jun 2025 21:45:48 +0100 Subject: [PATCH 6/6] Update dotnet-desktop.yml Change the conditional running of the release steps to also check head_ref --- .github/workflows/dotnet-desktop.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet-desktop.yml b/.github/workflows/dotnet-desktop.yml index 534b1d8..fbb53a9 100644 --- a/.github/workflows/dotnet-desktop.yml +++ b/.github/workflows/dotnet-desktop.yml @@ -102,11 +102,15 @@ jobs: run: | Write-Host "github.event_name: ${{ github.event_name }}" Write-Host "github.ref: ${{ github.ref }}" + Write-Host "github.head_ref: ${{ github.head_ref }}" # Set Date-Based Version for the Release - name: Set Date-Based Version id: version_generator - if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) + if: | + (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/'))) + || + (github.event_name == 'pull_request' && (github.head_ref == 'main' || startsWith(github.head_ref, 'fix/'))) shell: pwsh run: | $version = (Get-Date -Format "yyyy.MM.dd") + ".${{ github.run_number }}" @@ -116,7 +120,7 @@ jobs: # New Step: Create Release ZIP Package - name: Create Release ZIP Package id: create_zip_package - if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) + if: steps.version_generator.outputs.version_number != '' shell: pwsh run: | $appPackagesDir = "${{ env.Wap_Project_Directory }}\AppPackages" @@ -150,7 +154,7 @@ jobs: - name: Create Release id: create_release uses: ncipollo/release-action@v1 - if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/fix/')) && steps.version_generator.outputs.version_number != '' && steps.create_zip_package.outputs.zip_path != '' + if: steps.version_generator.outputs.version_number != '' && steps.create_zip_package.outputs.zip_path != '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: