docs: add gar and gcr example (#128)
This commit is contained in:
parent
b6d69ec4d4
commit
3b7fb59565
43
README.md
43
README.md
@ -277,6 +277,49 @@ jobs:
|
|||||||
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
|
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Authenticating to Container Registry and Artifact Registry
|
||||||
|
|
||||||
|
This example demonstrates authenticating to Google Container Registry (GCR) or
|
||||||
|
Google Artifact Registry (GAR). The most common way to authenticate to these
|
||||||
|
services is via a gcloud docker proxy. However, you can authenticate to these
|
||||||
|
registries directly using the `auth` action:
|
||||||
|
|
||||||
|
- **Username:** `oauth2accesstoken`
|
||||||
|
- **Password:** `${{ steps.auth.outputs.access_token }}`
|
||||||
|
|
||||||
|
You must set `token_format: access_token` in your Action YAML. Here are a few
|
||||||
|
examples:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
job_id:
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v2'
|
||||||
|
|
||||||
|
- id: 'auth'
|
||||||
|
name: 'Authenticate to Google Cloud'
|
||||||
|
uses: 'google-github-actions/auth@v0'
|
||||||
|
with:
|
||||||
|
token_format: 'access_token'
|
||||||
|
# Either user Workload Identity Federation or Service Account Keys. See
|
||||||
|
# above more more examples
|
||||||
|
|
||||||
|
# This example uses the docker login action
|
||||||
|
- uses: 'docker/login-action@v1'
|
||||||
|
with:
|
||||||
|
registry: 'gcr.io' # or REGION.docker.pkg.dev
|
||||||
|
username: 'oauth2accesstoken'
|
||||||
|
password: '${{ steps.auth.outputs.access_token }}'
|
||||||
|
|
||||||
|
# This example runs "docker login" directly to Artifact Registry.
|
||||||
|
- run: |-
|
||||||
|
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://REGION-docker.pkg.dev
|
||||||
|
|
||||||
|
# This example runs "docker login" directly to Container Registry.
|
||||||
|
- run: |-
|
||||||
|
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://gcr.io
|
||||||
|
```
|
||||||
|
|
||||||
### Configuring gcloud
|
### Configuring gcloud
|
||||||
|
|
||||||
This example demonstrates using this GitHub Action to configure authentication
|
This example demonstrates using this GitHub Action to configure authentication
|
||||||
|
Loading…
Reference in New Issue
Block a user