Skip to content

Commit

Permalink
Allow branch to build / deploy to be overriden
Browse files Browse the repository at this point in the history
no issue
Requested so that development branches can be built and deployed
  • Loading branch information
sam-lord committed Sep 7, 2023
1 parent d5d1679 commit 293af5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
secrets:
GCP_SA_JSON:
required: true
inputs:
BRANCH:
description: 'The branch to build for staging deployments'
default: main
type: string

env:
STG_PROJECT_ID: stg-pro-397609
Expand All @@ -16,11 +21,11 @@ env:
jobs:
docker:
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
if: github.event_name == 'push' && (github.ref == 'refs/heads/${{ inputs.BRANCH }}' || startsWith(github.ref, 'refs/tags/'))

steps:
- name: Set environment (Staging)
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/${{ inputs.BRANCH }}'
run: |
echo "ENVIRONMENT=staging" >> $GITHUB_ENV
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
secrets:
GCP_SA_JSON:
required: true
inputs:
BRANCH:
description: 'The branch to build for staging deployments'
default: main
type: string

env:
STG_PROJECT_ID: stg-pro-397609
Expand All @@ -16,11 +21,11 @@ env:
jobs:
docker:
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
if: github.event_name == 'push' && (github.ref == 'refs/heads/${{ inputs.BRANCH }}' || startsWith(github.ref, 'refs/tags/'))

steps:
- name: Set environment (Staging)
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/${{ inputs.BRANCH }}'
run: |
echo "ENVIRONMENT=staging" >> $GITHUB_ENV
Expand Down

0 comments on commit 293af5d

Please sign in to comment.