TL;DR It seems that there were various ways to deploy the Go app to Google App Engine with GitHub Actions, but now it seems better to use Action called google-github-actions / setup-gcloud provided by Google. https://github.com/google-github-actions/setup-gcloud
Set the GCP project ID in GCP_PROJECT_ID. Set the GCP service account key in GCP_SA_KEY. The service account can be the default one. When migrating from another service, don't forget to delete the past key.
.github/workflows/deploy.yml
name: "Deploy"
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Use gcloud CLI
run: gcloud app deploy --quiet app/web/app.yaml
At first I forgot to add --quiet and got an error.
I was able to move to GitHub Actions more easily than I expected. Let's use everyone!
Recommended Posts