publish #3
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: publish | |
| on: | |
| workflow_dispatch: # Manual trigger from GitHub Actions UI | |
| jobs: | |
| pack: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for trusted publishing OIDC token | |
| contents: write # Required to create GitHub release | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: 10.0.* | |
| - name: Pack | |
| run: dotnet pack | |
| - name: Get version | |
| id: version | |
| run: | | |
| VERSION=$(grep -oP '(?<=<SerdePkgVersion>)[^<]+' Directory.Build.props) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - name: NuGet login (OIDC) | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Publish package | |
| run: dotnet nuget push --skip-duplicate -k ${{ steps.nuget-login.outputs.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json artifacts/package/release/*.nupkg | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release create "v${{ steps.version.outputs.VERSION }}" --generate-notes --draft |