setup-gcloud/example-workflows/gae/README.md
2020-05-10 22:31:04 +02:00

2.7 KiB

App Engine - GitHub Actions

An example workflow that uses GitHub Actions to deploy a Hello World Node.js (TypeScript) app to App Engine. It also shows how to make App Engine to compile your app.

Workflow

For pushes to the default branch, master, the workflow will:

  1. Verify the Google Cloud Platform credentials are correct.

  2. Deploy the app to App Engine.

Setup

  1. Create or reuse a GitHub repository for the example workflow:

  2. Create a repository.

  3. Move into your repository directory.

  4. Copy the example into the repository:

cp -r <path_to>/github-actions/example-workflows/gae/ ./
  1. Add the the following role to your service account:
* `App Engine Deployer`: allows write access only to deploy and create a new version
* `App Engine Service Admin`: allows it to split or migrate traffic and start the new and stop an old version
* `Cloud Build Service Account - roles/cloudbuild.builds.builder`: allows for running and manipulating Cloud Build and Storage resources
* `Cloud Build Editor - roles/cloudbuild.builds.editor`: allows for deploying cloud builds
* `Service Account User - roles/iam.serviceAccountUser`: actAs requirement

`Browser - roles/browser` may or may not also required to allow for viewing and inserting items to the project (needed for Storage access).
  1. Fill in the repository's secret: * PROJECT_ID Your Project Id * GOOGLE_APPLICATION_CREDENTIALS Service Account Key

  2. Enable the App Engine API and Cloud Build API..

  3. Create Google App Engine project running gcloud app create in your console.

Run the workflow

  1. Add and commit your changes:
git add .
git commit -m "Set up GitHub workflow"
  1. Push to the master branch:
git push origin master
  1. View the workflow by selecting the Actions tab at the top of your repository. Then click on the Deploy to App Engine workflow to see the details.