Skip to content

An example workflow, using the GitHub Action, to deploy a static website to an existing Google Kubernetes Engine Cluster

License

Notifications You must be signed in to change notification settings

BaptisteDixneuf/example-gcloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Cloud - GitHub Action Example

An example workflow, using the GitHub Action for gcloud to deploy a static website to an existing Google Kubernetes Engine Cluster.

Workflow

The example workflow will trigger on every push to this repo.

For pushes to the feature branch, the workflow will:

  1. Build the Docker image
  2. Verify the Google Cloud Platform credentials are correct

For pushes to the default branch (master), in addition to the above Actions, the workflow will:

  1. Build the Docker image
  2. Verify the Google Cloud Platform credentials are correct
  3. 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 registers gcloud as a credential helper and uses the 'docker' command within the gcloud action to push the image.
  4. 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 name master may result in successful workflows that don't update the cluster.

Requirements

  1. Google Cloud Platform project
  2. GCP Service Account with write access to GCR and GKE for this project
  3. GCP Service Account credentials stored as a JSON key.
    1. The GCLOUD_AUTH secret, used by the gcloud-auth action, requires that this is base64 encoded
  4. An existing Kubernetes Engine cluster
    1. Create a Cluster

License

This repository is licensed under CC0-1.0, which waives all copyright restrictions.

About

An example workflow, using the GitHub Action, to deploy a static website to an existing Google Kubernetes Engine Cluster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published