From 7cdb289fa70df56b988b1cc46a7d0e25c2a02394 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Tue, 29 Oct 2024 15:11:23 +0100 Subject: [PATCH] ci: set release version Signed-off-by: Eguzki Astiz Lezaun --- .github/workflows/build-images-for-tag-release.yaml | 1 + .github/workflows/build-images.yaml | 7 +++++++ Makefile | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-images-for-tag-release.yaml b/.github/workflows/build-images-for-tag-release.yaml index 837802a..6178f9b 100644 --- a/.github/workflows/build-images-for-tag-release.yaml +++ b/.github/workflows/build-images-for-tag-release.yaml @@ -48,6 +48,7 @@ jobs: build-args: | GIT_SHA=${{ github.sha }} DIRTY=false + VERSION=${{ github.ref_name }} dockerfiles: | ./Dockerfile diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml index 7d4c0c7..53fa779 100644 --- a/.github/workflows/build-images.yaml +++ b/.github/workflows/build-images.yaml @@ -26,6 +26,12 @@ jobs: - name: Check out code uses: actions/checkout@v4 + - name: Read release string version + id: release + run: | + version=`make read-release-version` + echo version=$version >> $GITHUB_OUTPUT + - name: Add latest tag if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} id: add-latest-tag @@ -47,6 +53,7 @@ jobs: build-args: | GIT_SHA=${{ github.sha }} DIRTY=false + VERSION=${{ ${{ steps.release.outputs.version } }} dockerfiles: | ./Dockerfile diff --git a/Makefile b/Makefile index 97b1729..8484cc6 100644 --- a/Makefile +++ b/Makefile @@ -254,7 +254,7 @@ run-with-probes: manifests generate fmt vet ## Run a controller from your host. docker-build: GIT_SHA=$(shell git rev-parse HEAD || echo "unknown") docker-build: DIRTY=$(shell hack/check-git-dirty.sh || echo "unknown") docker-build: ## Build docker image with the manager. - $(CONTAINER_TOOL) build -t ${IMG} . --build-arg GIT_SHA=$(GIT_SHA) --build-arg DIRTY=$(DIRTY) + $(CONTAINER_TOOL) build -t ${IMG} . --build-arg VERSION=v$(VERSION) --build-arg GIT_SHA=$(GIT_SHA) --build-arg DIRTY=$(DIRTY) .PHONY: docker-push docker-push: ## Push docker image with the manager.