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 # 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 set -e
REPO="rclone" REPO="rclone/rclone"
if [ "$1" == "" ]; then if [ "$1" == "" ]; then
echo "Syntax: $0 Version" echo "Syntax: $0 Version"
exit 1 exit 1
fi fi
VERSION="$1" VERSION="$1"
if [ "$GITHUB_USER" == "" ]; then ANCHOR=$(grep '^## v' docs/content/changelog.md | head -1 | sed 's/^## //; s/[^A-Za-z0-9-]/-/g; s/--*/-/g')
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
echo "Making release ${VERSION}" cat > "/tmp/${VERSION}-release-notes" <<EOF
github-release release \ 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} \ --repo ${REPO} \
--tag ${VERSION} \ --title "rclone ${VERSION}" \
--name "rclone" \ --notes-file "/tmp/${VERSION}-release-notes"
--description "Rclone - rsync for cloud storage. Sync files to and from many cloud storage providers."
for build in `ls build | grep -v current | grep -v testbuilds`; do for build in build/*; do
echo "Uploading ${build}" case $build in
base="${build%.*}" *current*) continue ;;
parts=(${base//-/ }) *testbuilds*) continue ;;
os=${parts[3]} esac
arch=${parts[4]} echo "Uploading ${build} "
gh release upload "${VERSION}" \
github-release upload \ --clobber \
--repo ${REPO} \ --repo ${REPO} \
--tag ${VERSION} \ "${build}"
--name "${build}" \
--file build/${build}
done done
github-release info \ gh release view "${VERSION}" \
--repo ${REPO} \ --repo ${REPO}
--tag ${VERSION}
echo "Done" echo "Done"