cutbox_hub_release 814 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. # -*- mode: sh -*-
  3. notify() {
  4. echo "$1: $2"
  5. }
  6. if [[ $# == 3 ]]; then
  7. echo "Initialize hub release: ${@}"
  8. else
  9. echo "Usage: $0 <version> <dmg> <release-notes>"
  10. exit 1
  11. fi
  12. version=$1
  13. notify "Preparing hub release" "Version: ${version}"
  14. if [[ $version =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
  15. echo "Version: ${version}"
  16. else
  17. notify "Error" "Aborting: Version: ${version} is not valid (use semver)"
  18. echo "Usage: $0 <version> <dmg> <release-notes>"
  19. exit 3
  20. fi
  21. dmg=$2
  22. if [ -f "$3" ]; then
  23. file=$3
  24. else
  25. notify "Release notes" "$3 not found"
  26. exit 1
  27. fi
  28. echo "Setup a new release tag and upload current dmg"
  29. if [[ -f "$dmg" ]]; then
  30. gh release create -p \
  31. "$version" -F "$file"
  32. gh release upload "$version" "$dmg"
  33. else
  34. notify "Error" "dmg file: ${dmg} : not found"
  35. exit 4
  36. fi