github.com/artpar/rclone@v1.67.3/bin/upload-github (about)

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