Merge pull request #1015 from akunzai/deps/xunit-4.0.0 #155
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| draft-release: | |
| name: Update Release Draft | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Delete existing draft releases | |
| run: | | |
| gh release list --json tagName,isDraft \ | |
| --jq '.[] | select(.isDraft) | .tagName' | \ | |
| xargs -r -I{} gh release delete {} -y | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_REPO: ${{ github.repository }} | |
| - id: release-drafter | |
| uses: release-drafter/release-drafter@v7 | |
| with: | |
| publish: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-release: | |
| name: Publish GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check pre-release | |
| id: check | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| if echo "$TAG" | grep -qE '(alpha|beta|preview|rc)'; then | |
| echo "prerelease=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "prerelease=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - id: release-drafter | |
| uses: release-drafter/release-drafter@v7 | |
| with: | |
| publish: true | |
| prerelease: ${{ steps.check.outputs.prerelease == 'true' }} | |
| tag: ${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-nuget: | |
| name: Publish to NuGet | |
| needs: publish-release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| environment: production | |
| permissions: | |
| contents: read | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Set up .NET SDK | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: 10.0.x | |
| cache: true | |
| cache-dependency-path: '**/Directory.Packages.props' | |
| - name: Build packages | |
| run: | | |
| dotnet --info | |
| dotnet pack -o packages | |
| - name: NuGet login | |
| id: login | |
| uses: NuGet/login@v1 | |
| with: | |
| user: akunzai | |
| - name: Publish to NuGet.org | |
| run: dotnet nuget push "packages/*.nupkg" -k ${{ steps.login.outputs.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate |