Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make: Automatically create Go Modules compatible Git tag #3258

Merged
merged 4 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changelog/3258.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Make: Augment `tag-next-release` to create a Go Modules compatible Git tag

This implements the tagging scheme described in
[ADR 0002: Go Modules Compatible Git Tags].

[ADR 0002: Go Modules Compatible Git Tags]:
docs/adr/0002-go-modules-compatible-git-tags.md
10 changes: 6 additions & 4 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 'v$(NEXT_VERSION)'."
@$(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)" v$(NEXT_VERSION) $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)
@git push $(OASIS_CORE_GIT_ORIGIN_REMOTE) v$(NEXT_VERSION)
@$(ECHO_STDERR) "$(CYAN)Tag 'v$(NEXT_VERSION)' has been successfully pushed to $(OASIS_CORE_GIT_ORIGIN_REMOTE) remote.$(OFF)"
@git tag --sign --message="Version $(NEXT_VERSION)" $(RELEASE_TAG) $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)
@$(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)The following tags have been successfully pushed to $(OASIS_CORE_GIT_ORIGIN_REMOTE) remote:\n- $(RELEASE_TAG)\n- $(RELEASE_TAG_GO)$(OFF)"

# Prepare release.
release:
Expand Down
9 changes: 9 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ define ENSURE_NEXT_VERSION =
fi
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 =
if [[ ! $(RELEASE_BRANCH) =~ ^(master|(stable/[0-9]+\.[0-9]+\.x$$)) ]]; then \
Expand Down
5 changes: 3 additions & 2 deletions docs/adr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ After the ADR is merged an implementation may be undertaken by following the
The following records currently exist:

<!-- markdownlint-disable line-length -->
* [ADR-0000](0000-architectural-decision-records.md) - Architectural Decision Records
* [ADR-0001](0001-tm-multi-root-apphash.md) - Multiple Roots Under the Tendermint Application Hash
* [ADR 0000](0000-architectural-decision-records.md) - Architectural Decision Records
* [ADR 0001](0001-tm-multi-root-apphash.md) - Multiple Roots Under the Tendermint Application Hash
* [ADR 0002](0002-go-modules-compatible-git-tags.md) - Go Modules Compatible Git Tags
<!-- markdownlint-enable line-length -->