This guide explains how to set up service accounts for deck, primarily for CI/CD automation purposes.
Service accounts are mainly used for automated workflows where interactive OAuth2 authentication is not possible.
The service account needs the following OAuth2 scopes:
https://www.googleapis.com/auth/presentationshttps://www.googleapis.com/auth/drive
Newly created service accounts don't have their own Google Drive storage quota. You must:
- Create a Shared Drive (not a shared folder)
- Shared folders use the owner's quota, which service accounts don't have
- Learn more about Shared Drives
- Grant the service account Content Manager permission on the Shared Drive
- Use the
--folder-idflag with the Shared Drive ID:
deck apply slides.md --folder-id YOUR_SHARED_DRIVE_ID- Create a service account in Google Cloud Console
- Download the JSON key file
- Set the environment variable:
export DECK_SERVICE_ACCOUNT_KEY='{"type":"service_account",...}'
deck apply slides.mdMore secure as it doesn't require storing long-lived credentials.
- Configure Workload Identity Federation following google-github-actions/auth documentation
- Important: You still need a service account for Google Drive permissions
- Direct Workload Identity Federation without service account impersonation won't work
- Use in your workflow:
- uses: google-github-actions/auth@v2
with:
workload_identity_provider: 'projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_NAME>/providers/<PROVIDER_NAME>'
service_account: '<SERVICE_ACCOUNT_NAME>@<PROJECT_ID>.iam.gserviceaccount.com'
- run: deck apply slides.md --folder-id <SHARED_DRIVE_ID>
env:
DECK_ENABLE_ADC: '1'GitHub OIDC tokens expire in 5 minutes. For longer tasks, use an access token:
- uses: google-github-actions/auth@v2
id: auth
with:
token_format: 'access_token'
workload_identity_provider: 'projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_NAME>/providers/<PROVIDER_NAME>'
service_account: '<SERVICE_ACCOUNT_NAME>@<PROJECT_ID>.iam.gserviceaccount.com'
- run: deck apply slides.md --folder-id <SHARED_DRIVE_ID>
env:
DECK_ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}This method exchanges the OIDC token for a Google access token that typically lasts 1 hour.