forked from vmware/govmomi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·119 lines (98 loc) · 2.49 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash -e
# To release govc:
# - Bump Version version var in flags/version.go
# - Update ../CHANGELOG.md and ./CHANGELOG.md
# - Run: ../scripts/contributors.sh
# - Run: make doc
# - commit + merge to vmware/master
# - Run: git tag -m v0.17.0 v0.17.0
# - Install github-release
# - Set GITHUB_TOKEN
# - Run: ./release.sh release
if ! which github-release > /dev/null; then
echo 'Please install github-release...'
echo ''
echo ' $ go get github.com/aktau/github-release'
echo ''
exit 1
fi
if [ -z "${GITHUB_TOKEN}" ]; then
echo 'Please set GITHUB_TOKEN...'
exit 1
fi
export GITHUB_USER="${GITHUB_USER:-vmware}"
export GITHUB_REPO="${GITHUB_REPO:-govmomi}"
name="$(git describe --dirty)"
release=(github-release release --draft --name "${name}")
case "$1" in
release)
tag="${name}"
;;
prerelease)
tag="prerelease-${name}"
release+=(--pre-release)
;;
dryrun)
;;
*)
echo "Usage: $0 [release|prerelease]"
exit 1
;;
esac
echo "Building govc..."
rm -f ./govc_*
./build.sh
for name in govc_* ; do
if [ "${name: -4}" == ".exe" ] ; then
zip "${name}.zip" "$name" &
else
gzip -f "$name" &
fi
done
wait
if [ -n "$tag" ] ; then
echo "Pushing tag ${tag}..."
git tag -f "${tag}"
git push origin "refs/tags/${tag}"
fi
# Generate description
description=$(
if [[ "${tag}" == "prerelease-"* ]]; then
echo '**This is a PRERELEASE version.**'
fi
echo "
Documentation:
* [CHANGELOG](https://github.com/vmware/govmomi/blob/$tag/govc/CHANGELOG.md)
* [README](https://github.com/vmware/govmomi/blob/$tag/govc/README.md)
* [USAGE](https://github.com/vmware/govmomi/blob/$tag/govc/USAGE.md)
The binaries below are provided without warranty, following the [Apache license](LICENSE).
"
echo '
Instructions:
* Download the file relevant to your operating system
* Decompress (i.e. `gzip -d govc_linux_amd64.gz`)
* Set the executable bit (i.e. `chmod +x govc_linux_amd64`)
* Move the file to a directory in your `$PATH` (i.e. `mv govc_linux_amd64 /usr/local/bin/govc`)
'
echo '```'
echo '$ sha1sum govc_*.gz'
sha1sum govc_*.gz
echo '$ sha1sum govc_*.zip'
sha1sum govc_*.zip
echo '```'
)
release+=(--tag "${tag}" --description "${description}")
if [ -n "$tag" ] ; then
echo "Creating release..."
"${release[@]}"
else
echo "${release[@]}"
fi
# Upload build artifacts
for f in govc_*.{gz,zip}; do
echo "Uploading $f..."
if [ -n "$tag" ] ; then
github-release upload --tag "${tag}" --name "${f}" --file "${f}"
fi
done
echo "Remember to publish the draft release!"