Github action which will start a Google Cloud SQL Proxy.
Set up the following resources manually in the Cloud Console or use a tool like Terraform.
- Running Cloud SQL instance with a public IP address
- Create Service Account with Role
Cloud SQL Client
and do authentication via:
Variable | Description |
---|---|
creds |
Automatically exported as a short-lived Service Account JSON Key |
instance |
Required Cloud SQL connection name |
port |
Listen on port, default 5432 |
version |
Cloud SQL Proxy version, default latest |
jobs:
job_id:
# ...
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v3'
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
service_account: '[email protected]'
- uses: wagnerpereira/gce-cloudsql-proxy-action@v2
with:
instance: my-project:us-central1:instance-1