Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
permissions:
contents: read
packages: write
id-token: write # OIDC token for NuGet.org Trusted Publishing

steps:
- name: "Checkout"
Expand Down Expand Up @@ -112,14 +113,25 @@ jobs:
--package-version ${{ github.event.inputs.package-version }} \
--package-secret ${{ secrets.GITHUB_TOKEN }}

# Trusted Publishing: exchange a GitHub OIDC token for a short-lived NuGet.org key, so there is no
# long-lived NUGET_API_KEY to rotate or leak. The key lives one hour, hence immediately before the
# push rather than at the top of the job.
# Policy: owner LocalStack.NET, repo localstack-dotnet/localstack-dotnet-client, workflow publish-nuget.yml.
- name: "NuGet.org login (OIDC)"
id: nuget-login
if: ${{ github.event.inputs.package-source == 'nuget' }}
uses: NuGet/login@v1
with:
user: localstack-dotnet

- name: "Publish to NuGet.org"
if: ${{ github.event.inputs.package-source == 'nuget' }}
run: |
./build.sh --target nuget-push \
--package-source nuget \
--package-id ${{ github.event.inputs.package-id }} \
--package-version ${{ github.event.inputs.package-version }} \
--package-secret ${{ secrets.NUGET_API_KEY }}
--package-secret ${{ steps.nuget-login.outputs.NUGET_API_KEY }}

- name: "Upload Package Artifacts"
uses: actions/upload-artifact@v7
Expand Down
Loading