-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrelease.sh
executable file
·50 lines (39 loc) · 1.12 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
#!/bin/bash
set -e
REPO_NAME="${REPO_NAME:-launchpad}"
REPO_USER="${REPO_USER:-Mirantis}"
if [ -z "${TAG_NAME}" ]; then
echo "TAG_NAME not set"
exit 1
fi
artifact_path="dist/release"
artifacts=$(find ${artifact_path}/* -exec basename {} \;)
echo "Releasing with:"
for artifact in ${artifacts}; do echo "- ${artifact}"; done
curl -L https://github.com/github-release/github-release/releases/download/v0.10.0/linux-amd64-github-release.bz2 > ./github-release.bz2
bunzip2 -f ./github-release.bz2
chmod +x ./github-release
if [[ "${TAG_NAME}" == *-* ]] ; then
releaseopt="--pre-release"
else
releaseopt=""
fi
echo "Creating release named ${TAG_NAME} in ${REPO_NAME} repo"
./github-release release \
$releaseopt \
--user "${REPO_USER}" \
--repo "${REPO_NAME}" \
--tag "${TAG_NAME}" \
--name "${TAG_NAME}"
sleep 10
echo "Uploading the artifacts to ${TAG_NAME} in ${REPO_NAME} repo"
for artifact in ${artifacts}
do
./github-release upload \
--user "${REPO_USER}" \
--repo "${REPO_NAME}" \
--tag "${TAG_NAME}" \
--name "${artifact}" \
--file "${artifact_path}/${artifact}"
done
rm ./github-release