Skip to content

Commit 531c240

Browse files
authored
Fix RELEASE_TAG for git tag population: (#494)
## Description GitHub actions checks out the tag branch as a "detached HEAD" which caused the direct git tag lookup to be empty. This causes the release to fail. Fixes: # ## How Has This Been Tested? ## How are existing users impacted? What migration steps/scripts do we need? ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents 8fb140c + acb26c8 commit 531c240

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,25 @@ set-manifest-image:
159159
## Release
160160
## --------------------------------------
161161

162-
RELEASE_TAG := $(shell git describe --abbrev=0 2>/dev/null)
162+
# When running in GitHub Actions for a tag, use the tag name from GITHUB_REF
163+
# Otherwise, fall back to git describe to find the latest tag
164+
ifdef GITHUB_REF
165+
ifeq ($(findstring refs/tags/,$(GITHUB_REF)),refs/tags/)
166+
RELEASE_TAG := $(shell echo $(GITHUB_REF) | sed -e 's/refs\/tags\///')
167+
else
168+
RELEASE_TAG := $(shell git describe --abbrev=0 2>/dev/null)
169+
endif
170+
else
171+
RELEASE_TAG := $(shell git describe --abbrev=0 2>/dev/null)
172+
endif
163173
RELEASE_DIR ?= out/release
164174

165175
$(RELEASE_DIR):
166176
mkdir -p $(RELEASE_DIR)/
167177

168178
.PHONY: release
169179
release: clean-release
180+
@echo "Using RELEASE_TAG: $(RELEASE_TAG)"
170181
$(MAKE) set-manifest-image MANIFEST_IMG=$(REGISTRY)/$(IMAGE_NAME) MANIFEST_TAG=$(RELEASE_TAG)
171182
$(MAKE) release-manifests
172183
$(MAKE) release-metadata

0 commit comments

Comments
 (0)