-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.sh
executable file
·49 lines (38 loc) · 1.08 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
set -eou pipefail
version="$(git tag | sort --version-sort -r | head -1)"
last_tag_ref=$(git log --decorate | grep $version | cut -d' ' -f 2 | head -c 7)
last_commit_ref="$(git log -1 --oneline | cut -d' ' -f 1)"
echo $version $last_tag_ref $last_commit_ref
if [ ! $last_tag_ref == $last_commit_ref ]; then
echo "last commit is not last tag"
echo "last tag: $version"
exit 1
fi
export GITHUB_USER=endorama
export GITHUB_REPO=2ami
echo "Verifying release"
if gothub info | grep "name: '$version'" >/dev/null 2>&1; then
echo " This version already exists."
echo " Please remove it with 'gothub delete -u $GITHUB_USER -r $GITHUB_REPO -t $version'"
exit 0
fi
echo "Creating release $version"
if grep "-" "$version" >/dev/null 2>&1; then
gothub release \
--tag "$version" \
--name "$version" \
--pre-release
else
gothub release \
--tag "$version" \
--name "$version"
# --description \
fi
for file in dist/*; do
echo "Adding $file"
gothub upload \
--tag "$version" \
--name "$(basename "$file")" \
--file "$file";
done