From 37fa6a5b92901a8ad38252ecb1743d4796c0e4d7 Mon Sep 17 00:00:00 2001 From: Amisha Singla Date: Fri, 9 Aug 2024 16:02:34 -0500 Subject: [PATCH] update update update update update override update --- .github/workflows/build.yml | 17 ++++++++++++----- Makefile | 3 ++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f2b85e2..4001ae8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,11 +20,18 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Make docker image - uses: make docker-build + - name: Add SHORT_SHA env property with commit short sha + run: | + SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7) + echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_ENV + echo "Short SHA: $SHORT_SHA" - - name: Retag docker image - uses: docker tag stellar/stellar-etl:${{ github.sha }} stellar/stellar-etl-dev:${{ github.sha }} + - name: Make docker image + working-directory: . + run: make docker-build + env: + ETLHASH: stellar/stellar-etl-dev:${SHORT_SHA} - name: Push docker image - uses: docker push stellar/stellar-etl-dev:${{ github.sha }} + working-directory: . + run: docker push stellar/stellar-etl-dev:${SHORT_SHA} diff --git a/Makefile b/Makefile index a463e1f1..5a35388b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") # https://github.com/opencontainers/image-spec/blob/master/annotations.md BUILD_DATE := $(shell date -u +%FT%TZ) -ETLHASH=stellar/stellar-etl:$(shell git rev-parse --short HEAD) +DEFAULT_ETLHASH := stellar/stellar-etl:$(shell git rev-parse --short HEAD) +ETLHASH ?= $(DEFAULT_ETLHASH) docker-build: $(SUDO) docker build --platform linux/amd64 --pull --no-cache --label org.opencontainers.image.created="$(BUILD_DATE)" \