Skip to content
award

GitHub Action

Publish app to Google App Engine

v2.3.0 Latest version

Publish app to Google App Engine

award

Publish app to Google App Engine

Publish app to Google App Engine

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Publish app to Google App Engine

uses: zxyle/publish-gae-action@v2.3.0

Learn more about this action in zxyle/publish-gae-action

Choose a version

publish-gae-action

Build Status

This action allowed you publish application to Google App Engine.

Example

This project uses this action to published to Google App Engine.

BoardCAM.org

Usage

- name: Initialize Google Cloud SDK
  uses: zxyle/publish-gae-action@master
  with:
    service_account_email: ${{ secrets.GCP_SA_EMAIL }}
    service_account_key: ${{ secrets.GCP_SA_KEY }}
    project_id: ${{ secrets.PROJECT_ID }}
    # An optional variables parameter can be used
    gae_variables: ${{ secrets.GAE_VARIABLES }}

- name: Publish app to Google App Engine
  run: |
    # This client-secret.json is converted by GCP_SA_KEY.
    gcloud auth activate-service-account ${{ secrets.GCP_SA_EMAIL }} --key-file=client-secret.json
    gcloud config set project ${{ secrets.PROJECT_ID }}
    gcloud -q app deploy app.yaml --promote
    
    # Suppose you need a cron task.
    gcloud -q app deploy cron.yaml

Inputs

  • service_account_email: (Required) The service account email which will be used for authentication.

  • service_account_key: (Required) The service account key which will be used for authentication. This key should be created, encoded as a Base64 string (eg. cat my-key.json | base64 on macOS or Linux), and stored as a secret.

  • project_id: (Required) The project_id is google cloud platform project id. See this page to get it.

  • gae_variables: (Optional) App engine variables. This should be a json object encoded as a base64 string. This will be written into the app.yaml file at the root of your project. A sample variable file is shown here.

  • gae_config_path: (Optional) Path to the app.yml to use (./my/neseted/package/app.yml). Defaults to ./app.yml.

Note

Use 272.0.0 Google Cloud SDK by default on GitHub-hosted runners. If you need latest version, please refer to this action. But in most cases, this is enough.

Possible Errors

WARNING: You do not appear to have access to project [project-id] or it does not exist.

You must activate the Cloud Resource Manager API, to be fix this issue. Just replace YOUR_PROJECT_ID_HERE of the link bellow and click ENABLE.

https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=YOUR_PROJECT_ID_HERE

Sample variable file

{
  "beta_settings": {
    "cloud_sql_instances": "my_sql_instance"
  },
  "env_variables": {
    "DB_CONNECTION": "mysql",
    "DB_HOST": "127.0.0.1",
    "DB_PORT": 3306,
    "DB_USER": "mydbuser",
    "DB_DATABASE": "my_database",
    "DB_PASSWORD": "password",
    "DB_SOCKET": "/cloudsql/mys_sql_instance"
  }
}

On a Mac you can encode this into a base64 string by running the following command;

base64 -i myvariables.json

License

The scripts and documentation in this project are released under the MIT License