Created
May 27, 2024 04:34
-
-
Save bitclaw/62371b0d34dd3cb4a7835caa3355fb5c to your computer and use it in GitHub Desktop.
Remix Google Cloud Run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PROJECT_ID=<your-project-id> | |
# e.g. europe-west1 | |
export REGION=<your-region> | |
export APP_NAME=<your-app-name> | |
# | |
# Enable all required Google Cloud APIs | |
# | |
gcloud services enable artifactregistry.googleapis.com | |
gcloud services enable run.googleapis.com | |
gcloud services enable cloudbuild.googleapis.com | |
# | |
# Create a service account and bind the required roles to it | |
# | |
gcloud iam service-accounts create github-actions | |
gcloud projects add-iam-policy-binding $PROJECT_ID \ | |
--member="serviceAccount:github-actions@$PROJECT_ID.iam.gserviceaccount.com" \ | |
--role="roles/artifactregistry.admin" | |
gcloud projects add-iam-policy-binding $PROJECT_ID \ | |
--member="serviceAccount:github-actions@$PROJECT_ID.iam.gserviceaccount.com" \ | |
--role="roles/cloudbuild.builds.editor" | |
gcloud projects add-iam-policy-binding $PROJECT_ID \ | |
--member="serviceAccount:github-actions@$PROJECT_ID.iam.gserviceaccount.com" \ | |
--role="roles/run.admin" | |
gcloud projects add-iam-policy-binding $PROJECT_ID \ | |
--member="serviceAccount:github-actions@$PROJECT_ID.iam.gserviceaccount.com" \ | |
--role="roles/iam.serviceAccountUser" | |
gcloud projects add-iam-policy-binding $PROJECT_ID \ | |
--member="serviceAccount:github-actions@$PROJECT_ID.iam.gserviceaccount.com" \ | |
--role="roles/storage.admin" | |
# | |
# Create a key file so that your GitHub Action can interact with the GCP | |
# | |
gcloud iam service-accounts keys create credentials.json \ | |
--iam-account=github-actions@$PROJECT_ID.iam.gserviceaccount.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment