From 8709ff4bd8463a5ea1a6d0eb3d9ec0b24ab68ec3 Mon Sep 17 00:00:00 2001 From: Luca Beurer-Kellner Date: Tue, 11 Mar 2025 17:47:53 +0100 Subject: [PATCH] enable CI --- .github/workflows/publish-images.yml | 49 +++++++++++++--------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/publish-images.yml b/.github/workflows/publish-images.yml index 4e3421a..c160b34 100644 --- a/.github/workflows/publish-images.yml +++ b/.github/workflows/publish-images.yml @@ -1,17 +1,14 @@ name: Build Docker Images on: - # workflow_run: - # workflows: - # - Invariant gateway testing CI - # types: - # - completed - # branches: - # - main - # - v* - push: + workflow_run: + workflows: + - Invariant gateway testing CI + types: + - completed branches: - - ghcr + - main + - v* jobs: build-explorer-local-images: @@ -32,24 +29,22 @@ jobs: # based on whether this is a version tag or a branch, we will set the tags for the pushed images - name: Set Docker Tags id: set-tags - # run: | - # if [[ "${{ github.event.workflow_run.head_branch }}" == "main" ]]; then - # echo "tags=ghcr.io/${{ github.repository }}/app-api:latest" >> $GITHUB_ENV - # echo "tags_ui=ghcr.io/${{ github.repository }}/app-ui:latest" >> $GITHUB_ENV - # # starts with v* and only contains numbers and dots - # elif [[ "${{ github.event.workflow_run.head_branch }}" =~ ^v[0-9.]+$ ]]; then - # # get tag name from the event - # version=${{ github.event.workflow_run.head_branch }} - # # remove the refs/tags/ prefix - # echo "version string is $version" - # echo "tags=ghcr.io/${{ github.repository }}/app-api:latest,ghcr.io/${{ github.repository }}/app-api:${version}" >> $GITHUB_ENV - # echo "tags_ui=ghcr.io/${{ github.repository }}/app-ui:latest,ghcr.io/${{ github.repository }}/app-ui:${version}" >> $GITHUB_ENV - # else - # echo "Failed to determine the tags for the Docker images for branch ${{ github.event.workflow_run.head_branch }}" - # exit 1 - # fi run: | - echo "tags=ghcr.io/${{ github.repository }}/gateway:ghcr-testing" >> $GITHUB_ENV + if [[ "${{ github.event.workflow_run.head_branch }}" == "main" ]]; then + echo "tags=ghcr.io/${{ github.repository }}/app-api:latest" >> $GITHUB_ENV + echo "tags_ui=ghcr.io/${{ github.repository }}/app-ui:latest" >> $GITHUB_ENV + # starts with v* and only contains numbers and dots + elif [[ "${{ github.event.workflow_run.head_branch }}" =~ ^v[0-9.]+$ ]]; then + # get tag name from the event + version=${{ github.event.workflow_run.head_branch }} + # remove the refs/tags/ prefix + echo "version string is $version" + echo "tags=ghcr.io/${{ github.repository }}/app-api:latest,ghcr.io/${{ github.repository }}/app-api:${version}" >> $GITHUB_ENV + echo "tags_ui=ghcr.io/${{ github.repository }}/app-ui:latest,ghcr.io/${{ github.repository }}/app-ui:${version}" >> $GITHUB_ENV + else + echo "Failed to determine the tags for the Docker images for branch ${{ github.event.workflow_run.head_branch }}" + exit 1 + fi - name: build gateway image uses: docker/build-push-action@v5