6 # Get our process group id
7 # shellcheck disable=SC2009
8 PGID=$(ps -o pgid= $$ | grep -o "[0-9]*")
10 # Kill it in a new new process group
11 setsid kill -- -"$PGID"
15 trap "shutdown" SIGINT SIGTERM
18 echo "Need version as argument"
22 if [ -z "$GITHUB_TOKEN" ]; then
23 echo "Need GITHUB_TOKEN env set."
27 branch=$(git symbolic-ref --short -q HEAD)
28 if [ "$branch" != "develop" ]; then
29 echo "Need to be on develop branch."
34 directory_name="peertube-$version"
35 zip_name="peertube-$version.zip"
36 tar_name="peertube-$version.tar.xz"
38 changelog=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "$version" | sed '1{/^$/d}')
40 printf "Changelog will be:\\n%s\\n" "$changelog"
42 read -p "Are you sure to release? " -n 1 -r
44 if [[ ! $REPLY =~ ^[Yy]$ ]]
51 npm version --no-git-tag-version --no-commit-hooks "$1"
54 npm version -f --no-git-tag-version --no-commit-hooks "$1"
56 git commit package.json client/package.json -m "Bumped to version $version"
57 git tag -s -a "$version" -m "$version"
60 rm "./client/dist/stats.json"
62 # Creating the archives
65 directories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \
66 "$directory_name/LICENSE" "$directory_name/README.md" \
67 "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \
68 "$directory_name/client/package.json" "$directory_name/config" \
69 "$directory_name/dist" "$directory_name/package.json" \
70 "$directory_name/scripts" "$directory_name/support" \
71 "$directory_name/tsconfig.json" "$directory_name/yarn.lock")
72 maintainer_public_key="583A612D890159BE"
76 ln -s "PeerTube" "$directory_name"
78 # archive creation + signing
79 zip -r "PeerTube/$zip_name" "${directories_to_archive[@]}"
80 gpg --armor --detach-sign -u "$maintainer_public_key" "PeerTube/$zip_name"
81 XZ_OPT=-e9 tar cfJ "PeerTube/$tar_name" "${directories_to_archive[@]}"
82 gpg --armor --detach-sign -u "$maintainer_public_key" "PeerTube/$tar_name"
84 # temporary setup destruction
88 # Creating the release on GitHub, with the created archives
92 github-release release --user chocobozzz --repo peertube --tag "$version" --name "$version" --description "$changelog"
93 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$zip_name" --file "$zip_name"
94 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$zip_name.asc" --file "$zip_name.asc"
95 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$tar_name" --file "$tar_name"
96 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$tar_name.asc" --file "$tar_name.asc"
98 git push origin develop
100 # Update master branch
103 git push origin master