-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
37 lines (37 loc) · 1.41 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Authenticate npm with Google Artifact Registry
description: Generates an .npmrc file which configures authentication with Google Artifact Registry
inputs:
scope:
description: The Node.js Package Scope
required: true
project:
description: The Google Cloud Platform project to push to
required: true
repository:
description: The repository in Google Artifact Registry to push to
required: true
region:
description: The Google Cloud Platform region where the repository is located
required: true
default: europe-west3
serviceAccountKey:
description: The Service Account key to authenticate with Google Artifact Registry
required: true
runs:
using: composite
steps:
- name: Authenticate with Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ inputs.serviceAccountKey }}
token_format: access_token
create_credentials_file: false
- name: Generate .npmrc
shell: bash
run: |
cat > .npmrc <<EOF
@${{ inputs.scope }}:registry=https://${{ inputs.region }}-npm.pkg.dev/${{ inputs.project }}/${{ inputs.repository }}/
//${{ inputs.region }}-npm.pkg.dev/${{ inputs.project }}/${{ inputs.repository }}/:always-auth=true
//${{ inputs.region }}-npm.pkg.dev/${{ inputs.project }}/${{ inputs.repository }}/:_authToken=${{ steps.auth.outputs.access_token }}
EOF