This repository was archived by the owner on Sep 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,12 +110,16 @@ go test corectl_integration_test.go --update
110110
111111# # Release
112112
113- You create a release by pushing a git tag with semantic versioning.
113+ You create a release by pushing a commit and a tag with semantic versioning.
114114CircleCi will then run a release build that uses `goreleaser` to release `corectl` with the version set as the git tag.
115115
116- Example :
117- ` git tag v0.1.0 COMMIT-SHA`
118- ` git push origin v0.1.0`
116+ To create a release for e.g. version `v1.0.0` :
117+
118+ ` ` ` bash
119+ RELEASE_VERSION=v1.0.0 ./release.sh
120+ ` ` `
121+
122+ The script will update the API specification with the new version, create a commit with a tag and push to origin.
119123
120124# # Documentation
121125
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ function print_usage {
6+ echo " Usage:"
7+ echo " RELEASE_VERSION=v1.0.0 release.sh"
8+ echo " release.sh (-?, -h, --help)"
9+ echo
10+ echo " Options:"
11+ echo " -?, -h, --help - Prints this usage information."
12+ echo
13+ echo " Environment variables:"
14+ echo " - RELEASE_VERSION - Required. Set to a semantic version"
15+ echo
16+ }
17+
18+ if [[ $1 == " -?" || $1 == " -h" || $1 == " --help" ]]; then
19+ print_usage
20+ exit 0
21+ fi
22+
23+ function pre_flight_checks() {
24+ if [[ ! -z $( git status --porcelain) ]]; then
25+ echo " There are uncommitted changes. Please make sure branch is clean."
26+ exit 1
27+ fi
28+ }
29+
30+ # # Check that there are no uncommitted changes locally
31+ pre_flight_checks
32+
33+ # # Build corectl with the version number and generate an API specification
34+ echo " Generating new API specification for version ${RELEASE_VERSION} "
35+ go build -ldflags " -X main.version=${RELEASE_VERSION} "
36+ ./corectl generate-spec > docs/spec.json
37+
38+ # # Create a commit and add a tag
39+ echo " Creating commit and tag for version ${RELEASE_VERSION} "
40+ git commit -a -m " Release ${RELEASE_VERSION} "
41+ git tag -a $RELEASE_VERSION -m " Release ${RELEASE_VERSION} "
42+
43+ # # Push the commit and tag to origin
44+ echo " Pushing release version ${RELEASE_VERSION} to origin"
45+ git push --follow-tags
46+
47+ echo " Done."
You can’t perform that action at this time.
0 commit comments