Skip to content

Commit

Permalink
Rename Makefile var name
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds authored and mitjat committed Mar 12, 2024
1 parent 669cf65 commit 26466b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ shutdown-postgres:

confirm-version: fetch-git
@$(ECHO) "Latest published version is $(RED)v$(GIT_VERSION)$(OFF). You are about to publish $(CYAN)$(RELEASE_TAG)$(OFF)."
@$(ECHO) "If this is not what you want, re-run this command with VERSION=..."
@$(ECHO) "If this is not what you want, re-run this command with RELEASE_VERSION=..."
@$(CONFIRM_ACTION)

# Fetch all the latest changes (including tags) from the canonical upstream git
Expand All @@ -193,32 +193,32 @@ fetch-git:
@$(ECHO) "Fetching the latest changes (including tags) from $(GIT_ORIGIN_REMOTE) remote..."
@git fetch $(GIT_ORIGIN_REMOTE) --tags

# Used when APP_VERSION is not set and until we have versioning tool in repo.
# Used when RELEASE_VERSION is not set and until we have versioning tool in repo.
NEXT_PATCH_VERSION := $(shell echo $(GIT_VERSION) | awk 'BEGIN{FS=OFS="."} {$$NF = $$NF + 1; print}')
# Conditionally assign APP_VERSION if it is not already set.
APP_VERSION ?= $(NEXT_PATCH_VERSION)
# Conditionally assign RELEASE_VERSION if it is not already set.
RELEASE_VERSION ?= $(NEXT_PATCH_VERSION)
# Git tag of the next release.
RELEASE_TAG := v$(APP_VERSION)
RELEASE_TAG := v$(RELEASE_VERSION)

# Tag the next release.
release-tag: confirm-version
@$(ECHO) "Checking if we can tag version $(APP_VERSION) as the next release..."
@$(ECHO) "Checking if we can tag version $(RELEASE_VERSION) as the next release..."
@$(ENSURE_VALID_RELEASE_BRANCH_NAME)
@$(ENSURE_RELEASE_TAG_DOES_NOT_EXIST)
@$(ENSURE_NO_CHANGELOG_FRAGMENTS)
@$(ENSURE_NEXT_RELEASE_IN_CHANGELOG)
@$(ECHO) "All checks have passed. Proceeding with tagging the $(GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)'s HEAD with tag '$(RELEASE_TAG)'."
@$(CONFIRM_ACTION)
@$(ECHO) "If this appears to be stuck, you might need to touch your security key for GPG sign operation."
@git tag --sign --message="Version $(APP_VERSION)" $(RELEASE_TAG) $(GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)
@git tag --sign --message="Version $(RELEASE_VERSION)" $(RELEASE_TAG) $(GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)
@git push $(GIT_ORIGIN_REMOTE) $(RELEASE_TAG)
@$(ECHO) "$(CYAN)*** Tag '$(RELEASE_TAG)' has been successfully pushed to $(GIT_ORIGIN_REMOTE) remote.$(OFF)"

release-build: codegen-go
@goreleaser release --rm-dist

changelog: confirm-version
@$(ECHO) "$(CYAN)*** Generating Change Log for version $(APP_VERSION)...$(OFF)"
@$(ECHO) "$(CYAN)*** Generating Change Log for version $(RELEASE_TAG)...$(OFF)"
@$(BUILD_CHANGELOG)
@$(ECHO) "Next, review the staged changes, commit them and make a pull request."
@$(WARN_BREAKING_CHANGES)
Expand Down
8 changes: 4 additions & 4 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ endef
# Helper that builds the Change Log.
define BUILD_CHANGELOG =
if [[ $(ASSUME_YES) != 1 ]]; then \
towncrier build --version $(APP_VERSION); \
towncrier build --version $(RELEASE_VERSION); \
else \
towncrier build --version $(APP_VERSION) --yes; \
towncrier build --version $(RELEASE_VERSION) --yes; \
fi
endef

Expand Down Expand Up @@ -173,8 +173,8 @@ endef
# section for the next release.
define ENSURE_NEXT_RELEASE_IN_CHANGELOG =
if ! ( git show $(GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH):CHANGELOG.md | \
grep --quiet '^## $(APP_VERSION) (.*)' ); then \
$(ECHO) "$(RED)Error: Could not locate Change Log section for release $(APP_VERSION) on $(GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH) branch.$(OFF)"; \
grep --quiet '^## $(RELEASE_VERSION) (.*)' ); then \
$(ECHO) "$(RED)Error: Could not locate Change Log section for release $(RELEASE_VERSION) on $(GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH) branch.$(OFF)"; \
exit 1; \
fi
endef
Expand Down

0 comments on commit 26466b4

Please sign in to comment.