diff options
-rw-r--r-- | .github/workflows/build-deploy.yml | 7 | ||||
-rw-r--r-- | .github/workflows/main.yml | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 2582a4113..8f984d9b9 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -1,5 +1,9 @@ name: Build & Deploy +env: + # Used to determine whether we should push & deploy the docker image. + IS_MAIN_REF: ${{ github.ref == github.event.repository.default_branch }} + on: workflow_call: inputs: @@ -44,7 +48,7 @@ jobs: with: context: . file: ./Dockerfile - push: true + push: $IS_MAIN_REF cache-from: type=registry,ref=ghcr.io/python-discord/bot:latest cache-to: type=inline tags: | @@ -57,6 +61,7 @@ jobs: name: Deploy needs: build runs-on: ubuntu-latest + if: $IS_MAIN_REF environment: production steps: - name: Checkout Kubernetes repository diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f972b16f..a512f289d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,6 @@ jobs: build-deploy: - if: github.ref == 'refs/heads/main' uses: ./.github/workflows/build-deploy.yml needs: - lint-test |