Skip to content

Commit

Permalink
Make: Augment tag-next-release to create Go Modules compatible Git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tjanez committed Sep 9, 2020
1 parent 923743b commit 04e4384
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,14 @@ tag-next-release: fetch-git
@$(ENSURE_VALID_RELEASE_BRANCH_NAME)
@$(ENSURE_NO_CHANGELOG_FRAGMENTS)
@$(ENSURE_NEXT_VERSION_IN_CHANGELOG)
@$(ECHO_STDERR) "All checks have passed. Proceeding with tagging the $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)'s HEAD with tag '$(RELEASE_TAG)'."
@$(ECHO_STDERR) "All checks have passed. Proceeding with tagging the $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)'s HEAD with tags:\n- $(RELEASE_TAG)\n- $(RELEASE_TAG_GO)"
@$(CONFIRM_ACTION)
@$(ECHO_STDERR) "If this appears to be stuck, you might need to touch your security key for GPG sign operation."
@git tag --sign --message="Version $(NEXT_VERSION)" $(RELEASE_TAG) $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)
@git push $(OASIS_CORE_GIT_ORIGIN_REMOTE) $(RELEASE_TAG)
@$(ECHO_STDERR) "$(CYAN)Tag '$(RELEASE_TAG)' has been successfully pushed to $(OASIS_CORE_GIT_ORIGIN_REMOTE) remote.$(OFF)"
@$(ECHO_STDERR) "If this appears to be stuck, you might need to touch your security key for GPG sign operation."
@git tag --sign --message="Version $(NEXT_VERSION)" $(RELEASE_TAG_GO) $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)
@git push $(OASIS_CORE_GIT_ORIGIN_REMOTE) $(RELEASE_TAG) $(RELEASE_TAG_GO)
@$(ECHO_STDERR) "$(CYAN)Tags:\n- $(RELEASE_TAG)\n- $(RELEASE_TAG_GO)\nhave been successfully pushed to $(OASIS_CORE_GIT_ORIGIN_REMOTE) remote.$(OFF)"

# Prepare release.
release:
Expand Down
6 changes: 6 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ endef

# Git tag of the next release.
RELEASE_TAG := v$(NEXT_VERSION)
# Go Modules compatible Git tag of the next release.
RELEASE_TAG_GO = $(eval RELEASE_TAG_GO := $$(shell \
python3 -c "ver_parts = '$(NEXT_VERSION)'.split('.'); \
ver_parts.append(0) if len(ver_parts) == 2 else ''; \
print('go/v0.{}{:0>2}.{}'.format(*ver_parts))" \
))$(RELEASE_TAG_GO)

# Helper that ensures $(RELEASE_BRANCH) variable contains a valid release branch name.
define ENSURE_VALID_RELEASE_BRANCH_NAME =
Expand Down

0 comments on commit 04e4384

Please sign in to comment.