-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add usual release procedures to this project (#41)
## Which problem is this PR solving? - Anemic releasing docs. Let's bring it in-line with how we're releasing other Go libraries. ## Short description of the changes - added our usual release automation CI job (and put its smarts into a Makefile) - added a test target to the Makefile to match other Go libraries, and config CI to record test results - added RELEASING so the next human that needs to pull the release lever has some guidance
- Loading branch information
Showing
3 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.PHONY: test | ||
#: run the tests! | ||
test: | ||
ifeq (, $(shell which gotestsum)) | ||
@echo " ***" | ||
@echo "Running with standard go test because gotestsum was not found on PATH. Consider installing gotestsum for friendlier test output!" | ||
@echo " ***" | ||
go test -race -v ./... | ||
else | ||
gotestsum --junitfile unit-tests.xml --format testname -- -race ./... | ||
endif | ||
|
||
######################### | ||
### RELEASES ### | ||
######################### | ||
|
||
CIRCLE_TAG ?= | ||
RELEASE_VERSION ?= $(or $(CIRCLE_TAG), $(shell git describe --tags)) | ||
|
||
.PHONY: publish_github | ||
#: draft a GitHub release for current commit/tag and upload builds as its assets | ||
publish_github: github_prereqs | ||
@echo "+++ drafting GitHub release, tag $(RELEASE_VERSION)" | ||
@ghr -draft \ | ||
-name ${RELEASE_VERSION} \ | ||
-token ${GITHUB_TOKEN} \ | ||
-username ${CIRCLE_PROJECT_USERNAME} \ | ||
-repository ${CIRCLE_PROJECT_REPONAME} \ | ||
-commitish ${CIRCLE_SHA1} \ | ||
${RELEASE_VERSION} | ||
|
||
.PHONY: github_prereqs | ||
github_prereqs: ghr_present | ||
@:$(call check_defined, RELEASE_VERSION, the tag from which to create this release) | ||
@:$(call check_defined, GITHUB_TOKEN, auth to create this release) | ||
@:$(call check_defined, CIRCLE_PROJECT_USERNAME, user who will create this release) | ||
@:$(call check_defined, CIRCLE_PROJECT_REPONAME, the repository getting a new release) | ||
@:$(call check_defined, CIRCLE_SHA1, the git ref to associate with this release) | ||
|
||
|
||
################# | ||
### Utilities ### | ||
################# | ||
|
||
.PHONY: ghr_present | ||
ghr_present: | ||
@which ghr || (echo "ghr missing; required to create release at GitHub"; exit 1) | ||
|
||
check_defined = \ | ||
$(strip $(foreach 1,$1, \ | ||
$(call __check_defined,$1,$(strip $(value 2))))) | ||
__check_defined = \ | ||
$(if $(value $1),, \ | ||
$(error Undefined $1$(if $2, ($2))$(if $(value @), \ | ||
required by target `$@'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Release Process | ||
|
||
1. Add release entry to [changelog](./CHANGELOG.md) | ||
2. Open a PR with above changes. | ||
3. Once the above PR is merged, pull the updated `main` branch down and tag the merged release commit on `main` with the new version, e.g. `git tag -a v2.3.1 -m "v2.3.1"`. | ||
4. Push the tag, e.g. `git push origin v2.3.1`. This will kick off a CI workflow, which will publish a draft GitHub release. | ||
5. Update Release Notes on the new draft GitHub release by generating notes with the button and review for any PR titles that could use some wordsmithing or recategorization. |