Skip to content

Instantly share code, notes, and snippets.

@arslanbekov
Created November 24, 2022 16:40
Show Gist options
  • Save arslanbekov/47f02483561a7fbefa2f8982cb4c0d23 to your computer and use it in GitHub Desktop.
Save arslanbekov/47f02483561a7fbefa2f8982cb4c0d23 to your computer and use it in GitHub Desktop.
name: "Example Workload Identity"
on:
push:
branches:
- "master"
jobs:
run:
name: "Workload Identity Job"
permissions:
id-token: write
contents: read
runs-on: "ubuntu-latest"
steps:
- name: "Auth in GCP"
id: "auth"
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER_NAME }}
service_account: ${{ secrets.GCP_WORKLOAD_IDENTITY_SA_EMAIL }}
- name: "Docker login"
run: |
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://gcr.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment