Merge pull request #11 from penspanic/datra-json-cleanup #7
Workflow file for this run
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: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| nuget: | |
| name: Publish NuGet packages | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # MinVer + SourceLink + deterministic builds need full history. | |
| fetch-depth: 0 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| 10.0.x | |
| - name: Pack | |
| # MinVer reads the tag (vX.Y.Z) and applies it as Version to every packable project. | |
| # `dotnet pack <sln>` walks the solution and only packs projects with <IsPackable>true</IsPackable>. | |
| run: dotnet pack Datra.sln -c Release -o artifacts | |
| - name: Push to nuget.org | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| if: env.NUGET_API_KEY != '' | |
| run: | | |
| dotnet nuget push "artifacts/*.nupkg" \ | |
| --api-key "$NUGET_API_KEY" \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| - name: Skip notice (no NUGET_API_KEY secret) | |
| if: env.NUGET_API_KEY == '' | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: echo "::notice::NUGET_API_KEY secret not set; skipping nuget.org publish." | |
| - name: Upload package artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: artifacts/*.nupkg | |
| if-no-files-found: error | |
| github-release: | |
| name: Create GitHub release | |
| runs-on: ubuntu-latest | |
| needs: [nuget] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download nuget-packages artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: nuget-packages | |
| - name: Detect prerelease from tag | |
| id: tag | |
| run: | | |
| if [[ "${{ github.ref_name }}" == *-* ]]; then | |
| echo "prerelease=--prerelease" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "prerelease=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create release with .nupkg assets | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "${{ github.ref_name }}" \ | |
| --generate-notes \ | |
| --title "${{ github.ref_name }}" \ | |
| ${{ steps.tag.outputs.prerelease }} \ | |
| nuget-packages/*.nupkg |