Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add env_vars GH_AUTH_TOKEN to deploy step. #130

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ jobs:
region: ${{ secrets.GCP_CLOUDRUN_SERVICE_REGION }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
flags: --allow-unauthenticated --timeout 1800
env_vars: |
GH_AUTH_TOKEN=${{ secrets.GH_AUTH_TOKEN }}
source: .
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ Example response:
2. Create a key for the service account, this key will be configured as a secret in the GitHub actions to be able to deploy the app
3. For the service account, [grant the permissions "Service Account User", "Cloud Run Admin", "Storage Admin"](https://github.com/google-github-actions/deploy-cloudrun) and "Cloud Build Service Account", this last permission is necessary since cloud build will be used to build the image based on the source code directly
4. Clone this repo to your GitHub account
5. In the `Settings` of your GitHub repo, go to `Secrets` and create the `New repository secret` with the names and values below:
5. Create a [Github Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with `repo: public_repo` scope. Copy this token for use in the next step.
6. In the `Settings` of your GitHub repo, go to `Secrets` and create the `New repository secret` with the names and values below:
- `GCP_PROJECT_ID`: The [ID](https://support.google.com/googleapi/answer/7014113?hl=en) of the GCP project as found in your GCP Account
- `GCP_CLOUDRUN_SERVICE_NAME`: The name of the cloud run service, you can select any name that you prefer
- `GCP_CLOUDRUN_SERVICE_REGION`: The [region](https://cloud.google.com/compute/docs/regions-zones) in the GCP that you want to create the cloud run service
- `GCP_SA_KEY`: The key that you created for your service account with the permissions to deploy the app. This is a JSON object and should be used as-is
- `GH_AUTH_TOKEN`: The Github Personal Access Token created in the last step.

After the steps above have been completed, go to `Actions` in your GitHub repo and run the CD workflow located in `.git/workflows/cd.yml`. The file is already configured with the action to deploy the cloud run service using the secrets that were created.

Expand Down