Skip to content

Commit

Permalink
Added a production toggle to build and deploy actions
Browse files Browse the repository at this point in the history
no issue
This allows us to disable production builds (since we have no production infrastructure) when tags are pushed. This is especially useful when we're only wanting to build and deploy from a branch for staging during the development, and don't want a production build to override anything.
  • Loading branch information
sam-lord committed Oct 5, 2023
1 parent 0cf7ba6 commit 5096aa7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
description: 'The branch to build for staging deployments'
default: main
type: string
ENABLE_PRODUCTION:
description: 'Build production images based on tags'
default: true
type: boolean

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

steps:
- name: Set environment (Staging)
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
description: 'The branch to build for staging deployments'
default: main
type: string
ENABLE_PRODUCTION:
description: 'Deploy production builds based on tags'
default: true
type: boolean

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

steps:
- name: Set environment (Staging)
Expand Down

0 comments on commit 5096aa7

Please sign in to comment.