Sourav Badami's Blog
Tinkerer. Technomad. Rational.
Deploying Service to Google App Engine Using Github and Github Actions
Let's see how we can make use of Github Actions to deploy our service to Google App Engine (GAE) continuously.


What the hell is Github Actions and Google App Engine?

GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.

Google App Engine is a Platform as a Service and cloud computing platform for developing and hosting web applications in Google-managed data centers. Applications are sandboxed and run across multiple servers.


I’m assuming you’d already have your project up and running locally. Once it’s done you can manually deploy your project to app engine via gcloud app deploy.

  • GAE Project.
    • GCP_SA_KEY Service Account (Download the configuration JSON).
    • GCP_SA_EMAIL Service Account Email.
    • GCP_PROJECT_ID Project ID.
  • Github Repository (If you don’t have your codebase yet, you can use one of the boilerplate of your language of choice offered by Google for GAE).


Go to your project’s secrets (<username>/<repository>/settings/secrets) and update the details you just gathered.

Note: For GCP_SA_KEY, you need to first convert the JSON to base64 and then put the base64 value in the secrets. You can get the base64 value by passing your json to base64 binary as base64 -i service-account-config.json.


  • Go to your project’s actions workspace.
  • Paste this configuration in the editor and save with whatever name you want to .yml.
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
  # This workflow contains a single job called "build"
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2
    - name: setup
      uses: zxyle/publish-gae-action@v2.3
        service_account_email: ${{ secrets.GCP_SA_EMAIL }}
        service_account_key: ${{ secrets.GCP_SA_KEY }}
        project_id: ${{ secrets.GCP_PROJECT_ID }}

    - name: deploy
      run: |
        gcloud auth activate-service-account ${{ secrets.GCP_SA_EMAIL }} --key-file=client-secret.json
        gcloud config set project ${{ secrets.GCP_PROJECT_ID }}
        gcloud -q app deploy app.yaml --promote
  • Commit this workflow file.
  • Now whenever you merge a change to master, it’ll get deployed to App Engine.

Last modified on 2020-07-23

Comments powered by Disqus