aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar shtlrs <[email protected]>2023-05-21 09:58:11 +0100
committerGravatar Amrou Bellalouna <[email protected]>2023-05-24 11:36:10 +0100
commit5598065e9759d874f3c61a3b9f96d0cf7ee7eb8d (patch)
treeae94322a7016926a7997a9c99d2344cb6152fb2b
parentBump sentry-sdk from 1.22.2 to 1.24.0 (#2608) (diff)
build docker image in all PRs
This will always trigger the build-deploy workflow The image will only be pushed & deployed if we're in main.
-rw-r--r--.github/workflows/build-deploy.yml7
-rw-r--r--.github/workflows/main.yml1
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