Skip to content

Commit 14c41c0

Browse files
authored
chore: Update Azure publishing with OIDC steps (newrelic#3633)
1 parent 55f5d6e commit 14c41c0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/azure-site-extension.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
env:
1111
SPEC_FILE_TEMPLATE: 'NewRelic.Azure.WebSites.Extension.NodeAgent.nuspec'
1212

13+
permissions:
14+
# id-token must be set to `write` for OIDC publishing.
15+
id-token: write
16+
1317
jobs:
1418
create_extension_bundle:
1519
runs-on: windows-latest
@@ -23,15 +27,15 @@ jobs:
2327
arch: [ x64 ]
2428

2529
steps:
26-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
2731

2832
- name: Setup dotnet '6.0.x'
29-
uses: actions/setup-dotnet@v4
33+
uses: actions/setup-dotnet@v5
3034
with:
3135
dotnet-version: '6.0.x'
3236

3337
- name: Use Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v4
38+
uses: actions/setup-node@v6
3539
with:
3640
node-version: ${{ matrix.node-version }}
3741
architecture: ${{ matrix.arch }}
@@ -99,12 +103,19 @@ jobs:
99103

100104
# This step is for us to check what's going to be published
101105
- name: Archive package for verification
102-
uses: actions/upload-artifact@v4
106+
uses: actions/upload-artifact@v6
103107
with:
104108
name: azure-site-extension-test-${{ env.PACKAGE_FILENAME }}
105109
path: cloud-tooling/azure-site-extension/${{ env.PACKAGE_FILENAME }}.nupkg
106110

111+
# Get a short-lived NuGet API key via OIDC authorization.
112+
- name: NuGet login (OIDC → temp API key)
113+
uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1.1.0
114+
id: login
115+
with:
116+
user: ${{ vars.NUGET_TRUSTED_PUBLISH_POLICY_USER }}
117+
107118
- name: Publish site extension
108119
working-directory: cloud-tooling/azure-site-extension
109120
run: |
110-
dotnet nuget push "${{ env.PACKAGE_FILENAME }}.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source ${{ vars.NUGET_SOURCE }}
121+
dotnet nuget push "${{ env.PACKAGE_FILENAME }}.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source ${{ vars.NUGET_SOURCE }}

0 commit comments

Comments
 (0)