From 21eea32ac6ff5358d58d2887b1213c9b7802423c Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Fri, 6 Sep 2024 10:26:53 +0200 Subject: [PATCH 1/2] build container if test succeeds on main --- .github/workflows/build.yml | 4 +--- .github/workflows/container.yml | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74a21c7..19ee246 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,15 +1,13 @@ -name: Go +name: Build on: [push] jobs: build: - runs-on: ubuntu-latest strategy: matrix: go-version: ['1.22.4'] - steps: - uses: actions/checkout@v4 - name: Setup Go ${{ matrix.go-version }} diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 9959a05..af2f21d 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -1,11 +1,14 @@ name: Build container on: - #schedule: - # - cron: "0 10 * * *" - push: + workflow_run: + workflows: + - "Build" branches: - "main" + types: + - completed + push: tags: - "v*.*.*" From 28151a017a3e696e4e9ff6270b46761ec906074b Mon Sep 17 00:00:00 2001 From: Patrik Lundin Date: Wed, 11 Sep 2024 09:46:35 +0200 Subject: [PATCH 2/2] Add conditional checking for success Without this things will run even if the triggering workflow failed. Reference: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow --- .github/workflows/container.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index af2f21d..7feb785 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -14,6 +14,7 @@ on: jobs: container: + if: ${{ github.event.workflow_run.conclusion == 'success' }} name: Build and push container runs-on: ubuntu-latest permissions: