build: update GitHub release tool to use gh and put a link to changelog

Fixes #4994
This commit is contained in:
Nick Craig-Wood 2021-02-03 14:44:40 +00:00
parent 1415666074
commit 644cc69108
1 changed files with 25 additions and 29 deletions

View File

@ -2,49 +2,45 @@
#
# Upload a release
#
# Needs github-release from https://github.com/aktau/github-release
# Needs the gh tool from https://github.com/cli/cli
set -e
REPO="rclone"
REPO="rclone/rclone"
if [ "$1" == "" ]; then
echo "Syntax: $0 Version"
exit 1
fi
VERSION="$1"
if [ "$GITHUB_USER" == "" ]; then
echo 1>&2 "Need GITHUB_USER environment variable"
exit 1
fi
if [ "$GITHUB_TOKEN" == "" ]; then
echo 1>&2 "Need GITHUB_TOKEN environment variable"
exit 1
fi
ANCHOR=$(grep '^## v' docs/content/changelog.md | head -1 | sed 's/^## //; s/[^A-Za-z0-9-]/-/g; s/--*/-/g')
echo "Making release ${VERSION}"
github-release release \
cat > "/tmp/${VERSION}-release-notes" <<EOF
This is the ${VERSION} release of rclone.
Full details of the changes can be found in [the changelog](https://rclone.org/changelog/#${ANCHOR}).
EOF
echo "Making release ${VERSION} anchor ${ANCHOR} to repo ${REPO}"
gh release create "${VERSION}" \
--repo ${REPO} \
--tag ${VERSION} \
--name "rclone" \
--description "Rclone - rsync for cloud storage. Sync files to and from many cloud storage providers."
--title "rclone ${VERSION}" \
--notes-file "/tmp/${VERSION}-release-notes"
for build in `ls build | grep -v current | grep -v testbuilds`; do
echo "Uploading ${build}"
base="${build%.*}"
parts=(${base//-/ })
os=${parts[3]}
arch=${parts[4]}
github-release upload \
for build in build/*; do
case $build in
*current*) continue ;;
*testbuilds*) continue ;;
esac
echo "Uploading ${build} "
gh release upload "${VERSION}" \
--clobber \
--repo ${REPO} \
--tag ${VERSION} \
--name "${build}" \
--file build/${build}
"${build}"
done
github-release info \
--repo ${REPO} \
--tag ${VERSION}
gh release view "${VERSION}" \
--repo ${REPO}
echo "Done"