Skip to content

Commit 31b60dc

Browse files
adding tagging utils
Signed-off-by: Christopher Hein <[email protected]>
1 parent bb76012 commit 31b60dc

File tree

6 files changed

+63
-1
lines changed

6 files changed

+63
-1
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# CHANGELOG
2+
3+
<!-- START v0.0.1 -->
4+
<h2>v0.0.1</h2>
5+
6+
<li> <a href="http://github.com/christopherhein/go-version/commit/23afefc9d33c7fe374b828795a9a7667714a720c">view commit &bull;</a> Initial Commit</li>
7+
<li> <a href="http://github.com/christopherhein/go-version/commit/74881aa77393db20d6773ad61e79982142a95dc5">view commit &bull;</a> Adding a CONTRIBUTING guidelines</li>
8+
<li> <a href="http://github.com/christopherhein/go-version/commit/40cb0851e0ba63cb63844b1a30ce5087c0b5abba">view commit &bull;</a> Adding Support for Empty Values</li>
9+
<li> <a href="http://github.com/christopherhein/go-version/commit/812a3b5e32acb9effed36765ee30f96295003288">view commit &bull;</a> Adding tests and using new gopath domain</li>
10+
<!-- END v0.0.1 -->
11+
12+
<!-- START v0.0.2 -->
13+
<h2>v0.0.2</h2>
14+
15+
<li> <a href="http://github.com/christopherhein/go-version/commit/081d4af106f494175ca14564c74c1e69bb52cf57">view commit &bull;</a> adding import path comment</li>
16+
<li> <a href="http://github.com/christopherhein/go-version/commit/621eb71f28ce57ed6b96a8fd3263c660b7a67d08">view commit &bull;</a> adding version subcommand func</li>
17+
<li> <a href="http://github.com/christopherhein/go-version/commit/be514ca4251048d7b23c3adb65d8e52adae8048f">view commit &bull;</a> adding example</li>
18+
<li> <a href="http://github.com/christopherhein/go-version/commit/c4749b3a224b57c63e74cef8985c913f6815c32f">view commit &bull;</a> adding updated readme</li>
19+
<li> <a href="http://github.com/christopherhein/go-version/commit/d6bf711fd8d1d8781063cb4675c01a55047f0e50">view commit &bull;</a> adding go.* and new ignored files</li>
20+
<li> <a href="http://github.com/christopherhein/go-version/commit/26135532bf16d68bb4a847c85a75bfad056261a6">view commit &bull;</a> adding travis configs</li>
21+
<li> <a href="http://github.com/christopherhein/go-version/commit/29fcf12885ec860b1b4882fb8c1bb367229adcc6">view commit &bull;</a> rename travis conf</li>
22+
<li> <a href="http://github.com/christopherhein/go-version/commit/228057b8af6028387af98e5f5b249e680e1874d7">view commit &bull;</a> adding build tag</li>
23+
<li> <a href="http://github.com/christopherhein/go-version/commit/7f7626f2dbe830824a0bc4a58bef9feb91e5afdf">view commit &bull;</a> adding tests for the cobra function</li>
24+
<li> <a href="http://github.com/christopherhein/go-version/commit/2fb52ece41075900f7a5bd3ac7a245900669a8fc">view commit &bull;</a> adding go.mod and go.sum</li>
25+
<!-- END v0.0.2 -->
26+

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
VERSION := $(shell cat VERSION)
2+
3+
.PHONY: deps
4+
deps:
5+
@npm i generate-changelog -g
6+
@go get golang.org/x/lint/golint
7+
18
.PHONY: all
29
all: build-example test
310

@@ -14,4 +21,12 @@ test:
1421

1522
.PHONY: build-example
1623
build-example:
17-
./hack/build_example.sh
24+
./hack/build-example.sh
25+
26+
.PHONY: generate-changelog
27+
generate-changelog:
28+
./hack/generate-changelog.sh
29+
30+
.PHONY: tag
31+
tag:
32+
./hack/tag-release.sh

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.2
File renamed without changes.

hack/generate-changelog.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
PREV_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
4+
NEW_HASH=$(git rev-parse --verify HEAD)
5+
NEXT_TAG=$(cat VERSION)
6+
7+
OUTPUT=$(git log ${PREV_VERSION}..${NEW_HASH} --no-merges --pretty=format:'<li> <a href="http://github.com/christopherhein/go-version/commit/%H">view commit &bull;</a> %s</li> ' --reverse)
8+
9+
echo "<!-- START ${NEXT_TAG} -->" >> "CHANGELOG.md"
10+
echo "<h2>${NEXT_TAG}</h2>" >> "CHANGELOG.md"
11+
echo "" >> "CHANGELOG.md"
12+
echo "${OUTPUT}" >> "CHANGELOG.md"
13+
echo "<!-- END ${NEXT_TAG} -->" >> "CHANGELOG.md"
14+
echo "" >> "CHANGELOG.md"

hack/tag-release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
NEXT_TAG=$(cat VERSION)
4+
MSG=$(cat CHANGELOG.md | xargs | egrep -o "<\!-- START ${NEXT_TAG} -->.*?<\!-- END ${NEXT_TAG} -->")
5+
6+
git tag -s -m "${MSG}" ${NEXT_TAG}

0 commit comments

Comments
 (0)