Only run gcloud build when it's a push

This commit is contained in:
Deirdre Connolly 2020-05-15 23:12:54 -04:00 committed by Deirdre Connolly
parent 77b42d2048
commit 796eddfb25
1 changed files with 15 additions and 14 deletions

View File

@ -10,20 +10,21 @@ on:
jobs:
# build:
# name: Google Cloud Build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
# with:
# version: '275.0.0'
# service_account_key: ${{ secrets.GCLOUD_AUTH }}
# - name: Build, Test, Push to GCR
# run: |
# BRANCH_NAME=$GITHUB_REPOSITORY/$(expr $GITHUB_REF : '.*/\(.*\)') && \
# BRANCH_NAME=${BRANCH_NAME,,} && \
# gcloud builds submit . --config cloudbuild.yaml --project zealous-zebra --substitutions BRANCH_NAME=$BRANCH_NAME
build:
name: Google Cloud Build
if: github.head_ref || github.base_ref # This is a pull request, and would fail for external PRs.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '275.0.0'
service_account_key: ${{ secrets.GCLOUD_AUTH }}
- name: Build, Test, Push to GCR
run: |
BRANCH_NAME=$GITHUB_REPOSITORY/$(expr $GITHUB_REF : '.*/\(.*\)') && \
BRANCH_NAME=${BRANCH_NAME,,} && \
gcloud builds submit . --config cloudbuild.yaml --project zealous-zebra --substitutions BRANCH_NAME=$BRANCH_NAME
test:
name: Build and test on ${{ matrix.os }}