From 20653ac9f2459551e1cdefe7fbb78697984b308f Mon Sep 17 00:00:00 2001 From: Nick Le Large Date: Thu, 31 Oct 2024 12:15:45 +0100 Subject: [PATCH 1/2] Read version from file and tag docker image in GitHub workflow --- .github/workflows/build-and-push-docker.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-docker.yaml b/.github/workflows/build-and-push-docker.yaml index 4edc8fca..b7010083 100644 --- a/.github/workflows/build-and-push-docker.yaml +++ b/.github/workflows/build-and-push-docker.yaml @@ -3,13 +3,16 @@ name: Build and Push Docker Image on: push: branches: - - main + - add_version_tag_to_docker_image # TODO: switch to main before merge jobs: build-and-push-image: runs-on: ubuntu-latest steps: + - name: Check out the repository + uses: actions/checkout@v4 + - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: @@ -25,9 +28,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Read version from file + run: | + cat version >> $GITHUB_ENV + - name: Build and push Docker image uses: docker/build-push-action@v5 with: push: true - tags: ghcr.io/kit-mrt/arbitration_graphs:latest - + tags: | + ghcr.io/kit-mrt/arbitration_graphs:latest + ghcr.io/kit-mrt/arbitration_graphs:${{ env.VERSION }} From 514b8035a68eefe47985ae29e58f6c1f5c18fc18 Mon Sep 17 00:00:00 2001 From: Nick Le Large Date: Thu, 31 Oct 2024 12:32:50 +0100 Subject: [PATCH 2/2] Remove feature branch from triggers and run only on merge to main --- .github/workflows/build-and-push-docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-docker.yaml b/.github/workflows/build-and-push-docker.yaml index b7010083..06f9fbb9 100644 --- a/.github/workflows/build-and-push-docker.yaml +++ b/.github/workflows/build-and-push-docker.yaml @@ -3,7 +3,7 @@ name: Build and Push Docker Image on: push: branches: - - add_version_tag_to_docker_image # TODO: switch to main before merge + - main jobs: build-and-push-image: