File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,7 @@ jobs:
462462 grafana-url : ${{ inputs.playwright-grafana-url }}
463463 secrets : ${{ (fromJson(needs.test-and-build.outputs.workflow-context).isTrusted && inputs.playwright-secrets != '') && inputs.playwright-secrets || '' }}
464464 node-version : ${{ inputs.node-version }}
465+ npm-registry-auth : ${{ inputs.npm-registry-auth }}
465466
466467 playwright-docker :
467468 name : Plugins - Dockerized Playwright E2E tests
@@ -480,6 +481,8 @@ jobs:
480481 report-path : ${{ inputs.playwright-report-path }}
481482 grafana-url : ${{ inputs.playwright-grafana-url }}
482483 secrets : ${{ (fromJson(needs.test-and-build.outputs.workflow-context).isTrusted && inputs.playwright-secrets != '') && inputs.playwright-secrets || '' }}
484+ # TODO: add support for NPM auth in Dockerized Playwright as well
485+ # npm-registry-auth: ${{ inputs.npm-registry-auth }}
483486
484487 upload-to-gcs :
485488 name : Upload to GCS
Original file line number Diff line number Diff line change 6363 description : Node.js version to use
6464 type : string
6565 required : false
66-
66+ npm-registry-auth :
67+ description : |
68+ Whether to authenticate to the npm registry in Google Artifact Registry.
69+ If true, the root of the plugin repository must contain a `.npmrc` file.
70+ type : boolean
71+ required : false
72+ default : false
6773permissions :
6874 contents : read
6975 id-token : write
@@ -110,6 +116,20 @@ jobs:
110116 node-version : ${{ inputs.node-version }}
111117 node-version-file : ${{ inputs.plugin-directory }}/.nvmrc
112118
119+ - name : Login to Google Cloud
120+ if : inputs.npm-registry-auth == true
121+ uses : google-github-actions/auth@b7593ed2efd1c1617e1b0254da33b86225adb2a5 # v2.1.12
122+ with :
123+ token_format : access_token
124+ workload_identity_provider : " projects/304398677251/locations/global/workloadIdentityPools/github/providers/github-provider"
125+ service_account : github-plugin-ci-workflows@grafanalabs-workload-identity.iam.gserviceaccount.com
126+
127+ - name : NPM registry auth
128+ if : inputs.npm-registry-auth == true
129+ shell : bash
130+ working-directory : ${{ inputs.plugin-directory }}
131+ run : GOOGLE_APPLICATION_CREDENTIALS=${{ env.GOOGLE_APPLICATION_CREDENTIALS }} npx google-artifactregistry-auth --credential-config ./.npmrc
132+
113133 - name : Install npm dependencies
114134 # TODO: find a better way
115135 run : |
You can’t perform that action at this time.
0 commit comments