upload-github 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env bash
  2. #
  3. # Upload a release
  4. #
  5. # Needs the gh tool from https://github.com/cli/cli
  6. set -e
  7. REPO="rclone/rclone"
  8. if [ "$1" == "" ]; then
  9. echo "Syntax: $0 Version"
  10. exit 1
  11. fi
  12. VERSION="$1"
  13. ANCHOR=$(grep '^## v' docs/content/changelog.md | head -1 | sed 's/^## //; s/[^A-Za-z0-9-]/-/g; s/--*/-/g')
  14. cat > "/tmp/${VERSION}-release-notes" <<EOF
  15. This is the ${VERSION} release of rclone.
  16. Full details of the changes can be found in [the changelog](https://rclone.org/changelog/#${ANCHOR}).
  17. EOF
  18. echo "Making release ${VERSION} anchor ${ANCHOR} to repo ${REPO}"
  19. gh release create "${VERSION}" \
  20. --repo ${REPO} \
  21. --title "rclone ${VERSION}" \
  22. --notes-file "/tmp/${VERSION}-release-notes" \
  23. --draft=true
  24. for build in build/*; do
  25. case $build in
  26. *current*) continue ;;
  27. *testbuilds*) continue ;;
  28. esac
  29. echo "Uploading ${build} "
  30. gh release upload "${VERSION}" \
  31. --clobber \
  32. --repo ${REPO} \
  33. "${build}"
  34. done
  35. gh release edit "${VERSION}" \
  36. --repo ${REPO} \
  37. --draft=false
  38. gh release view "${VERSION}" \
  39. --repo ${REPO}
  40. echo "Done"