google-github-actions / deploy-appengine

A GitHub Action that deploys source code to Google App Engine.
https://cloud.google.com/appengine
254 stars 72 forks source link
actions app-engine appengine gae gcp github-actions google-app-engine google-appengine google-cloud google-cloud-platform

deploy-appengine

This action deploys your source code to App Engine and makes the URL available to later build steps via outputs. This allows you to parameterize your App Engine deployments.

This is not an officially supported Google product, and it is not covered by a Google Cloud support contract. To report bugs or request features in a Google Cloud product, please contact Google Cloud support.

Prerequisites

Usage

jobs:
  job_id:
    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
    - id: 'auth'
      uses: 'google-github-actions/auth@v2'
      with:
        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'

    - id: 'deploy'
      uses: 'google-github-actions/deploy-appengine@v2'

    # Example of using the output
    - id: 'test'
      run: 'curl "${{ steps.deploy.outputs.version_url }}"'

Inputs


app.yaml customizations

Other application configurations can be customized through the app.yaml, ie the service name. See app.yaml Configuration File for more information.

Outputs

Authorization

There are a few ways to authenticate this action. The caller must have the following Google Cloud IAM Roles:

Note: An owner will be needed to create the App Engine application.

Via google-github-actions/auth

Use google-github-actions/auth to authenticate the action. This Action supports both the recommended Workload Identity Federation based authentication and the traditional Service Account Key JSON based auth.

jobs:
  job_id:
    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
    - id: 'auth'
      uses: 'google-github-actions/auth@v2'
      with:
        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'

    - id: 'deploy'
      uses: 'google-github-actions/deploy-appengine@v2'

Via Application Default Credentials

If you are hosting your own runners, and those runners are on Google Cloud, you can leverage the Application Default Credentials of the instance. This will authenticate requests as the service account attached to the instance. This only works using a custom runner hosted on GCP.

jobs:
  job_id:
    steps:
    - id: 'deploy'
      uses: 'google-github-actions/deploy-appengine@v2'

Advanced Configuration

Custom Build Timeouts

The default Google Cloud Build timeout to compile the application may be too short for some services. To extend the build timeout, set the CLOUDSDK_APP_CLOUD_BUILD_TIMEOUT environment variable to an integer representing the number of seconds for the timeout. Do not customize this value unless you are getting errors about build timeouts. This will consume more build minutes.

jobs:
  job_id:
    steps:
    - uses: 'google-github-actions/deploy-appengine@v2'
      env:
        CLOUDSDK_APP_CLOUD_BUILD_TIMEOUT: 1800 # 30 minutes