An updated version of this example can be found here
There are a couple preliminary steps that you'll need to take prior to creating your deployment workflow.
- Create a service account and download the json private key file. Be sure you don't commit this file to your repo on accident! Best practice is to minimize the number of permissions this service account has, but for getting setup, you can give the service account project owner permissions and figure out exactly what scope is appropriate later. Click here for docs on creating a service account: https://cloud.google.com/iam/docs/creating-managing-service-account-keys#iam-service-account-keys-create-console
- Open a new terminal and cd into the folder your keyfile is located in, then run the following command:
base64 /path_to_your/key_files.json
- Copy and paste the resulting output into a new Secret, which you can create in your repos settings under Secrets. Name the secret GCLOUD_AUTH.
- Next, you'll need to enable the App Engine Admin API, so you can interact with it programatically. You may need to give it a few seconds before this is enabled successfully. https://cloud.google.com/appengine/docs/admin-api/accessing-the-api
- Finally, you should have this already if you're using App Engine, but make sure you have your App Engine app.yaml file prepared. I would also highly recommend creating a .gcloudignore and .gitignore file if you haven't already to ensure your service account key file isn't committed/pushed to Github or uploaded to App Engine.
- Copy the other file in this Gist, main.yml into your repository.
mkdir your/repo/.github/workflows touch your/repo/.github/main.yml
Open this newly created file and paste the contents of the example workflow. The only thing you need to do is to make sure your app.yaml file is named correctly.