Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 067b1ec

Browse files
authored
[gha] fix artifactregistry login (#990)
Add and fix artifactregistry login. Taken from #978
1 parent a882a34 commit 067b1ec

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,42 @@ 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+
project_id: aptos-registry
37+
38+
- name: Login to GCP Artifact Registry
39+
run: pnpm artifactregistry-login
40+
env:
41+
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.create_credentials_file.outputs.credentials_file }}
42+
43+
- name: Install Dependencies
44+
run: pnpm install --frozen-lockfile
45+
2646
- 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)