Skip to content

Commit 9a846bc

Browse files
committed
[gha] fix artifactregistry login
1 parent a882a34 commit 9a846bc

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,39 @@ on:
55
branches:
66
- main
77
pull_request:
8-
branches:
9-
- main
8+
9+
permissions:
10+
contents: read
11+
id-token: write #required for GCP Workload Identity federation which we use to login into Google Artifact Registry
1012

1113
jobs:
1214
lint:
1315
runs-on: ubuntu-latest
1416

1517
steps:
1618
- uses: actions/checkout@v4
19+
1720
- uses: pnpm/action-setup@v4
1821
with:
1922
version: 9.15.1
23+
2024
- uses: actions/setup-node@v4
2125
with:
2226
node-version: '23'
2327
cache: 'pnpm'
2428
registry-url: "https://registry.npmjs.org"
25-
- run: pnpm install --frozen-lockfile
29+
30+
- name: Authenticate to Google Cloud
31+
uses: google-github-actions/auth@v2
32+
with:
33+
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
34+
service_account: ${{ vars.GCP_SERVICE_ACCOUNT_EMAIL }}
35+
create_credentials_file: true # This exports the GOOGLE_APPLICATION_CREDENTIALS env var which is commonly used by CLIs
36+
37+
- name: Login to GCP Artifact Registry
38+
run: pnpm artifactregistry-login
39+
40+
- name: Install Dependencies
41+
run: pnpm install --frozen-lockfile
42+
2643
- run: pnpm lint

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "turbo dev",
77
"lint": "turbo lint",
88
"fmt": "turbo run fmt",
9-
"spellcheck": "turbo run spellcheck"
9+
"spellcheck": "turbo run spellcheck",
10+
"artifactregistry-login": "pnpm dlx google-artifactregistry-auth"
1011
},
1112
"dependencies": {
1213
"turbo": "2.5.0"

0 commit comments

Comments
 (0)