Better (working) way of checking for a release
This commit is contained in:
1 parent
ab4aa21cca
commit
801ca43fbf
1 file changed
+37
-15
+37
-15
@@ -71,30 +71,52 @@ publish() {
|
|||||||
|
|
||||||
echo == Sanity checks
|
echo == Sanity checks
|
||||||
|
|
||||||
|
if ! which github-release >/dev/null; then
|
||||||
|
echo Please install git-release: >&2
|
||||||
|
echo -e "\tgo get github.com/aktau/github-release" >&2
|
||||||
|
echo and create a git token per https://github.com/aktau/github-release >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Check that the tag exists by looking at github
|
||||||
|
if ! curl -sSf https://api.github.com/repos/$GITHUB_USER/weave/git/tags/$LATEST_TAG_SHA >/dev/null 2>&1; then
|
||||||
|
echo -e "\u2757 Tag $LATEST_TAG is not on GitHub" >&2
|
||||||
|
echo -e "\thttps://github.com/$GITHUB_USER/weave/tags" >&2
|
||||||
|
echo "You may need to" >&2
|
||||||
|
echo -e "\tgit push --tags"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/weave"
|
||||||
|
|
||||||
## Check that the version doesn't already exist by looking at github
|
## Check that the version doesn't already exist by looking at github
|
||||||
## releases
|
## releases
|
||||||
if curl -sSf https://api.github.com/repos/zettio/weave/releases/$LATEST_TAG 2>/dev/null; then
|
if github-release info --user $GITHUB_USER --repo weave --tag $LATEST_TAG >/dev/null 2>&1; then
|
||||||
echo Release $LATEST_TAG already exists on GitHub >&2
|
echo -e "\u2757 Release $LATEST_TAG already exists on GitHub" >&2
|
||||||
echo https://github.com/zettio/weave/releases/$LATEST_TAG >&2
|
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '** Sanity checks OK for publishing tag' $LATEST_TAG as zettio/weave:$VERSION
|
echo '** Sanity checks OK for publishing tag' $LATEST_TAG as zettio/weave:$VERSION
|
||||||
|
|
||||||
if ! which github-release; then
|
echo == Creating GitHub release $RELEASE_NAME $VERSION
|
||||||
echo Please install git-release:
|
# This cannot be done as a draft because of a bug in
|
||||||
echo go get github.com/aktau/github-release
|
# github-release: https://github.com/aktau/github-release/issues/7
|
||||||
echo and create a git token per https://github.com/aktau/github-release
|
github-release release \
|
||||||
exit 1
|
--user $GITHUB_USER \
|
||||||
fi
|
|
||||||
|
|
||||||
echo == Creating GitHub release $VERSION
|
|
||||||
github-release release --user $GITHUB_USER \
|
|
||||||
--repo weave \
|
--repo weave \
|
||||||
--tag $LATEST_TAG \
|
--tag $LATEST_TAG \
|
||||||
--name "$RELEASE_NAME" \
|
--name "$RELEASE_NAME $VERSION" \
|
||||||
--description "$RELEASE_DESCRIPTION" \
|
--description "$RELEASE_DESCRIPTION"
|
||||||
--pre-release
|
|
||||||
|
github-release upload \
|
||||||
|
--user $GITHUB_USER \
|
||||||
|
--repo weave \
|
||||||
|
--tag $LATEST_TAG \
|
||||||
|
--name "weave" \
|
||||||
|
--file "./weave"
|
||||||
|
|
||||||
|
echo "** Published release $RELEASE_NAME $VERSION"
|
||||||
|
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
|||||||
Reference in new issue
Block a user