diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 3159bbc..bbb2484 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -38,7 +38,7 @@ jobs: # pack nuget - run: dotnet build -c Release -p:Version=${{ inputs.tag }} - run: dotnet test tests/ZString.Tests -c Release --no-build - - run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish + - run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o ./publish # Store artifacts. - uses: Cysharp/Actions/.github/actions/upload-artifact@main with: @@ -96,8 +96,35 @@ jobs: path: ./src/ZString.Unity/ZString.Unity.${{ inputs.tag }}.unitypackage retention-days: 1 + # publish + publish: + name: "Publish NuGet packages" + needs: [build-dotnet, build-unity] + permissions: + contents: read + id-token: write # required for NuGet Trusted Publish + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main + - uses: Cysharp/Actions/.github/actions/download-artifact@main + # push nuget + - name: NuGet login (OIDC) + uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 + id: login + with: + user: ${{ secrets.NUGET_USER }} + - run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}" + if: ${{ !inputs.dry-run }} + env: + NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }} + - run: dotnet nuget push "./nuget/*.snupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}" + if: ${{ !inputs.dry-run }} + env: + NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }} + create-release: - needs: [update-packagejson, build-dotnet, build-unity] + needs: [update-packagejson, publish] permissions: contents: write id-token: write # required for NuGet Trusted Publish @@ -106,14 +133,14 @@ jobs: commit-id: ${{ needs.update-packagejson.outputs.sha }} tag: ${{ inputs.tag }} dry-run: ${{ inputs.dry-run }} - nuget-push: true + nuget-push: false release-upload: true release-asset-path: ./ZString.Unity.${{ inputs.tag }}.unitypackage/ZString.Unity.${{ inputs.tag }}.unitypackage secrets: inherit cleanup: if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }} - needs: [update-packagejson, build-dotnet, build-unity] + needs: [update-packagejson, create-release] permissions: contents: write uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main