diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d12c9d2..15f960c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -3,7 +3,6 @@ name: .NET on: push: branches: [ master ] - create: tags: - '*.*.*' pull_request: @@ -19,34 +18,33 @@ jobs: uses: actions/setup-dotnet@v5 with: dotnet-version: '10.0.x' - + - name: Check Tag id: check-tag run: | - if [[ v${{ github.event.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$GITHUB_REF" =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then echo "match=true" >> $GITHUB_OUTPUT fi - + - name: Run Unit Tests run: | dotnet restore dotnet build dotnet test test/NosCore.ParserInputGenerator.Tests -v m - + - name: Build Artifact if: steps.check-tag.outputs.match == 'true' id: build_artifact run: | + TAG_NAME=${GITHUB_REF#refs/tags/} dotnet restore dotnet build -c Release - dotnet pack -c Release -o /tmp/nupkgs -v m -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg - dotnet nuget push /tmp/nupkgs/NosCore.ParserInputGenerator.${{github.event.ref}}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} - echo "ARTIFACT_PATH=/tmp/nupkgs/NosCore.ParserInputGenerator.${{github.event.ref}}.snupkg" >> $GITHUB_OUTPUT - echo "ARTIFACT_NAME=NosCore.ParserInputGenerator.${{github.event.ref}}.snupkg" >> $GITHUB_OUTPUT - + dotnet pack -c Release -o /tmp/nupkgs -v m -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:PackageVersion=${TAG_NAME} + dotnet nuget push /tmp/nupkgs/NosCore.ParserInputGenerator.${TAG_NAME}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} + echo "ARTIFACT_PATH=/tmp/nupkgs/NosCore.ParserInputGenerator.${TAG_NAME}.nupkg" >> $GITHUB_OUTPUT + - name: Upload Release Asset if: steps.check-tag.outputs.match == 'true' uses: softprops/action-gh-release@v2 with: files: ${{ steps.build_artifact.outputs.ARTIFACT_PATH }} -