@@ -207,10 +207,16 @@ COMMIT_MESSAGE="release: prepare ${VERSION}"
207207git commit -m " $COMMIT_MESSAGE "
208208echo -e " ${GREEN} Created commit: $COMMIT_MESSAGE ${NC} "
209209
210- # Check for GoReleaser and GITHUB_TOKEN (before creating tag)
210+ # Create temporary tag for GoReleaser validation (will be recreated after amending)
211+ echo -e " ${YELLOW} Creating temporary git tag ${VERSION} for GoReleaser...${NC} "
212+ git tag -a " $VERSION " -m " Go ContextForge SDK $VERSION "
213+ echo -e " ${GREEN} Created temporary tag: $VERSION ${NC} "
214+
215+ # Check for GoReleaser and GITHUB_TOKEN
211216if ! command -v goreleaser & > /dev/null; then
212217 echo -e " ${RED} Error: goreleaser is not installed${NC} "
213218 echo -e " ${YELLOW} Install with: go install github.com/goreleaser/goreleaser/v2@latest${NC} "
219+ git tag -d " $VERSION "
214220 git reset --hard HEAD~1
215221 exit 1
216222fi
@@ -223,7 +229,8 @@ if [ -z "$GITHUB_TOKEN" ]; then
223229 echo -e " ${YELLOW} Continue anyway? Release will fail but you can retry later. (y/N)${NC} "
224230 read -r response
225231 if [[ ! " $response " =~ ^[Yy]$ ]]; then
226- echo -e " ${YELLOW} Undoing commit...${NC} "
232+ echo -e " ${YELLOW} Undoing tag and commit...${NC} "
233+ git tag -d " $VERSION "
227234 git reset --hard HEAD~1
228235 exit 1
229236 fi
233240echo -e " ${YELLOW} Running GoReleaser...${NC} "
234241if ! goreleaser release --clean; then
235242 echo -e " ${RED} Error: GoReleaser failed${NC} "
236- echo -e " ${YELLOW} Undoing commit...${NC} "
243+ echo -e " ${YELLOW} Undoing tag and commit...${NC} "
244+ git tag -d " $VERSION "
237245 git reset --hard HEAD~1
238246 exit 1
239247fi
@@ -244,7 +252,8 @@ echo -e "${GREEN}GoReleaser completed successfully!${NC}"
244252echo -e " ${YELLOW} Merging changelog...${NC} "
245253if ! merge_changelog " $VERSION " ; then
246254 echo -e " ${RED} Error: Changelog merge failed${NC} "
247- echo -e " ${YELLOW} Undoing commit...${NC} "
255+ echo -e " ${YELLOW} Undoing tag and commit...${NC} "
256+ git tag -d " $VERSION "
248257 git reset --hard HEAD~1
249258 exit 1
250259fi
@@ -256,10 +265,11 @@ git add CHANGELOG.md
256265git commit --amend --no-edit
257266echo -e " ${GREEN} Updated release commit with changelog${NC} "
258267
259- # Create annotated tag (after commit is amended so tag points to final commit)
260- echo -e " ${YELLOW} Creating git tag ${VERSION} ...${NC} "
268+ # Delete temporary tag and recreate on amended commit (so tag points to final commit hash)
269+ echo -e " ${YELLOW} Recreating git tag ${VERSION} on final commit...${NC} "
270+ git tag -d " $VERSION "
261271git tag -a " $VERSION " -m " Go ContextForge SDK $VERSION "
262- echo -e " ${GREEN} Created annotated tag: $VERSION ${NC} "
272+ echo -e " ${GREEN} Created final tag: $VERSION ${NC} "
263273
264274# Display next steps
265275echo " "
0 commit comments