storj/scripts/draft-release.sh
Igor 352e937813
scripts: add changelog to release draft (#4791)
* scripts: add changelog to release draft

* scripts: fix run command

* rename variable

* rename variable

* fix command

* add comment

* rename variable

Co-authored-by: Stefan Benten <mail@stefan-benten.de>
2022-09-28 19:17:40 +03:00

33 lines
1021 B
Bash
Executable File

#!/usr/bin/env bash
# usage: $0 vMAJOR.MINOR.PATCH[-rc[-*]] PATH/TO/BINARIES
set -euo pipefail
apps="identity uplink storagenode multinode"
TAG="${1-}"
if ! [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc+(-.*)?)?$ ]]; then
echo "No tag detected, skipping release drafting"
exit 0
fi
FOLDER="${2-}"
echo "Drafting release"
current_release_version=$(echo "$TAG" | cut -d '.' -f 1-2)
previous_release_version=$(git describe --tags $(git rev-list --exclude='*rc*' --exclude=$current_release_version* --tags --max-count=1))
changelog=$(python3 changelog.py "$previous_release_version" "$TAG" 2>&1)
github-release release --user storj --repo storj --tag "$TAG" --description "$changelog" --draft
echo "Sleep 10 seconds in order to wait for release propagation"
sleep 10
echo "Uploading binaries to release draft"
for app in $apps; do
for file in "$FOLDER/$app"*.zip; do
github-release upload --user storj --repo storj --tag "$TAG" --name $(basename "$file") --file "$file"
done
done
echo "Drafting release done"