Skip to content

Commit 3c04578

Browse files
Migrate to OIDC
Update the publish workflow to use OIDC to authenticate instead of retrieving an access token from an Azure Key Vault. Signed-off-by: Elliot Huffman <elliot_huffman@shilab.com>
1 parent ed0f203 commit 3c04578

1 file changed

Lines changed: 7 additions & 27 deletions

File tree

.github/workflows/GenerateSdk.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ jobs:
4848
- name: Setup Node.JS Runtime
4949
uses: actions/setup-node@v4
5050
with:
51-
node-version: 22.x
51+
node-version: 22
5252
cache: 'npm'
5353
cache-dependency-path: ${{matrix.specifications.sdkPath}}/package-lock.json
54-
registry-url: https://registry.npmjs.org/
54+
registry-url: https://registry.npmjs.org
5555
scope: shi-corp
5656

57+
# Update the NPM CLI to the latest available version
58+
- name: Update NPM CLI
59+
run: npm install -g npm
60+
5761
# Set up all of the supporting components for SDK generation
5862
- name: Initialize Kiota Binaries
5963
uses: microsoft/setup-kiota@v0.5.0
@@ -78,31 +82,7 @@ jobs:
7882
run: npm run-script build:Prod
7983
working-directory: ${{matrix.specifications.sdkPath}}
8084

81-
# Log into the Entra ID with the GitHub federated identity credential (using the OIDC token)
82-
- name: Login to Entra ID
83-
uses: azure/login@v2
84-
with:
85-
enable-AzPSSession: true
86-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
87-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
88-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
89-
90-
# Deploys the zip package to the specified azure web app
91-
- name: Get NPM Publish Token
92-
uses: azure/powershell@v2
93-
id: NPM-Publish-Token
94-
with:
95-
azPSVersion: latest
96-
inlineScript: |
97-
# Get the publish token from the specified Azure KeyVault
98-
[System.String]$PublishToken = Get-AzKeyVaultSecret -VaultName ${{secrets.KEYVAULT_NAME}} -Name ${{secrets.KEYVAULT_SECRET_NAME}} -AsPlainText
99-
100-
# Write the token to GitHub Actions Output to be accessible to subsequent steps
101-
echo "npmToken=$PublishToken" >> $env:GITHUB_OUTPUT
102-
10385
# Publish the artifact to NPM with attestation
10486
- name: Upload Package to NPM Registry
105-
run: npm publish --access public --provenance
87+
run: npm publish
10688
working-directory: ${{matrix.specifications.sdkPath}}
107-
env:
108-
NODE_AUTH_TOKEN: ${{ steps.NPM-Publish-Token.outputs.npmToken }}

0 commit comments

Comments
 (0)