An example workflow, using the GitHub Action for gcloud to deploy a static website to an existing Google Kubernetes Engine Cluster.
The example workflow will trigger on every push to this repo.
For pushes to the feature branch, the workflow will:
- Build the Docker image
- Verify the Google Cloud Platform credentials are correct
For pushes to the default branch (master
), in addition to the above Actions, the workflow will:
- Build the Docker image
- Verify the Google Cloud Platform credentials are correct
- Tag and Push the image to Google Container Registry
- The image is available through the following tags:
latest
, the branch name, and first 8 of the commit SHA gcloud
serves as a credential helper for Docker. This workflow registersgcloud
as a credential helper and uses the 'docker' command within thegcloud
action to push the image.
- The image is available through the following tags:
- Use a Kubernetes Deployment to push an image to the Cluster
- Note that a GKE deployment requires a unique Tag to update the pods. Using a constant tag
latest
or a branch namemaster
may result in successful workflows that don't update the cluster.
- Note that a GKE deployment requires a unique Tag to update the pods. Using a constant tag
- Google Cloud Platform project
- GCP Service Account with write access to GCR and GKE for this project
- GCP Service Account credentials stored as a JSON key.
- The
GCLOUD_AUTH
secret, used by the gcloud-auth action, requires that this is base64 encoded
- The
- An existing Kubernetes Engine cluster
This repository is licensed under CC0-1.0, which waives all copyright restrictions.