Skip to content

Commit 43abbde

Browse files
committed
create make target ensuring unique version
1 parent 4086a3e commit 43abbde

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ fmtcheck:
3131
test -z $(shell go fmt $(SOURCE))
3232
.PHONY: fmtcheck
3333

34-
tag:
34+
check-tag:
35+
./scripts/ensure-unique-version.sh "$(VERSION)"
36+
37+
tag: check-tag
3538
echo "creating git tag $(VERSION)"
3639
git tag $(VERSION)
3740
git push origin $(VERSION)

scripts/ensure-unique-version.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
version="${1}"
4+
repo="mdb/gh-dispatch"
5+
6+
result="$(curl \
7+
--header "Accept: application/vnd.github.v3+json" \
8+
--write "%{http_code}" \
9+
--out "/dev/null" \
10+
"https://api.github.com/repos/${repo}/releases/tags/${version}")"
11+
12+
if [ "${result}" = "404" ]; then
13+
exit 0
14+
fi
15+
16+
echo "${version} is an existing ${repo} release"
17+
exit 1

0 commit comments

Comments
 (0)