This action allowed you publish application to Google App Engine.
This project uses this action to published to Google App Engine.
- 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
-
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.
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.
{
"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
The scripts and documentation in this project are released under the MIT License