Skip to content

Instantly share code, notes, and snippets.

@williamli
Created February 16, 2019 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamli/f09c9a2c34b89fbf9fcf10f733b3f879 to your computer and use it in GitHub Desktop.
Save williamli/f09c9a2c34b89fbf9fcf10f733b3f879 to your computer and use it in GitHub Desktop.
Google Cloud Build with GitHub plugin
steps:
# Decrypt the file containing the key
- name: 'gcr.io/cloud-builders/gcloud'
args: ...
steps:
# Debug - checks files checkedout from Github
# - name: 'gcr.io/cloud-builders/gcloud'
# entrypoint: 'bash'
# args:
# - '-c'
# - |
# ls -la
# ls -la wp-content
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
echo
echo
echo "Deploying and building branch $BRANCH_NAME @ $REPO_NAME ($SHORT_SHA)..."
echo
echo
case $BRANCH_NAME in
master)
gcloud builds submit --gcs-log-dir=gs://cloudbuild.bbi.codes/$REPO_NAME/$BRANCH_NAME/$SHORT_SHA/logs --gcs-source-staging-dir=gs://cloudbuild.bbi.codes/$REPO_NAME/$BRANCH_NAME/$SHORT_SHA/sources --config=cloudbuild-deploy.yaml --substitutions=_ENVIRONMENT="production",REPO_NAME="$REPO_NAME",SHORT_SHA="$SHORT_SHA",BRANCH_NAME="$BRANCH_NAME"
;;
*)
echo
echo
echo "branch $BRANCH_NAME ignored."
echo
echo
;;
esac
logsBucket: 'gs://cloudbuild.bbi.codes/$REPO_NAME/$BRANCH_NAME/$SHORT_SHA'
# options:
# substitution_option: 'ALLOW_LOOSE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment