Created
February 16, 2019 02:46
-
-
Save williamli/f09c9a2c34b89fbf9fcf10f733b3f879 to your computer and use it in GitHub Desktop.
Google Cloud Build with GitHub plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
# Decrypt the file containing the key | |
- name: 'gcr.io/cloud-builders/gcloud' | |
args: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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