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..8373e2d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,44 @@ +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 }} + +jobs: + 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