Skip to content

Commit f22a1e2

Browse files
authored
Use OIDC to login to GCR (#3838)
1 parent 186eec3 commit f22a1e2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/build-plus.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,21 @@ jobs:
5151
- name: Docker Buildx
5252
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
5353

54-
- name: GCR Login
54+
- name: Authenticate to Google Cloud
55+
id: auth
56+
uses: google-github-actions/auth@e8df18b60c5dd38ba618c121b779307266153fbf # v1.1.0
57+
with:
58+
token_format: access_token
59+
workload_identity_provider: ${{ secrets.GCR_WORKLOAD_IDENTITY }}
60+
service_account: ${{ secrets.GCR_SERVICE_ACCOUNT }}
61+
if: github.event_name != 'pull_request'
62+
63+
- name: Login to GCR
5564
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
5665
with:
5766
registry: gcr.io
58-
username: _json_key
59-
password: ${{ secrets.GCR_JSON_KEY }}
67+
username: oauth2accesstoken
68+
password: ${{ steps.auth.outputs.access_token }}
6069
if: github.event_name != 'pull_request'
6170

6271
- name: Configure AWS Credentials

0 commit comments

Comments
 (0)