From fab408dd02effe3a0af94e2f5b767a83e954c813 Mon Sep 17 00:00:00 2001 From: Tony Knight Date: Mon, 23 Jun 2025 11:07:59 +0100 Subject: [PATCH 1/2] new release workflow --- .github/workflows/buildtestpackage.yml | 32 +------------------ .github/workflows/release.yaml | 43 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/buildtestpackage.yml b/.github/workflows/buildtestpackage.yml index 225f864..3776621 100644 --- a/.github/workflows/buildtestpackage.yml +++ b/.github/workflows/buildtestpackage.yml @@ -104,34 +104,4 @@ jobs: SAST: uses: ./.github/workflows/sast.yml - Release: - runs-on: ubuntu-latest - needs: [ Build, SCA, Stryker, SAST ] - # if: github.event_name == 'push' && github.actor != 'dependabot[bot]' - if: false - - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x - - - name: Download package - uses: actions/download-artifact@v4 - with: - name: benchmarkdotnet.analyser.nupkg - path: ${{ github.workspace }}/artifacts - - - name: Push nuget package - run: dotnet nuget push "artifacts/*.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --source "nuget.org" - - - name: Create Github Release - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag: v${{ env.build-version-number }} - prerelease: false - generateReleaseNotes: true \ No newline at end of file + \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ddebf9e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,43 @@ +name: Build Test and Package + +permissions: # set permissions to principle of least privilege, codeql requires read permission to the repo content and PRs (if that option is set), and must have write permissions to security events in order to push results + actions: read + pull-requests: write + security-events: write + contents: write + checks: write + +on: + workflow_dispatch: + +env: + build-version-number: 0.4.${{ github.run_number }} + + Release: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Restore tools + run: dotnet tool restore + + - name: Build test and package + run: dotnet run --project build.fsproj -- -t "BuildTestAndPackage" + + - name: Push nuget package + run: dotnet nuget push "publish/toolpackage/*.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --source "nuget.org" + + - name: Create Github Release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: v${{ env.build-version-number }} + prerelease: false + generateReleaseNotes: true \ No newline at end of file From 57a37e764a5af8214c61fd064167b61f81cede72 Mon Sep 17 00:00:00 2001 From: Tony Knight Date: Mon, 23 Jun 2025 11:09:18 +0100 Subject: [PATCH 2/2] :facepalm: --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ddebf9e..8373e2d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,6 +13,7 @@ on: env: build-version-number: 0.4.${{ github.run_number }} +jobs: Release: runs-on: ubuntu-latest if: github.ref == 'refs/heads/main'