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 maintainer_public_key
=${MAINTAINER_GPG:-"583A612D890159BE"}
29 branch
=$(git symbolic-ref --short -q HEAD)
30 if [ "$branch" != "develop" ] && [[ "$branch" != release
/* ]]; then
31 echo "Need to be on develop or release branch."
36 github_prerelease_option
=""
37 if [[ "$version" = *"-alpha."* ]] || [[ "$version" = *"-beta."* ]] || [[ "$version" = *"-rc."* ]]; then
38 echo -e "This is a pre-release.\n"
39 github_prerelease_option
="--pre-release"
42 directory_name
="peertube-$version"
43 zip_name
="peertube-$version.zip"
44 tar_name
="peertube-$version.tar.xz"
46 changelog
=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "## $version" | sed '1{/^$/d}')
48 printf "Changelog will be:\\n\\n%s\\n\\n" "$changelog"
50 read -p "Are you sure to release? " -n 1 -r
52 if [[ ! $REPLY =~ ^
[Yy
]$
]]; then
58 npm version
--no-git-tag-version --no-commit-hooks "$1"
61 npm version
-f --no-git-tag-version --no-commit-hooks "$1"
63 git commit package.json client
/package.json .
/support
/doc
/api
/openapi.yaml
-m "Bumped to version $version"
64 git tag
-s -a "$version" -m "$version"
66 npm run build
-- --source-map
67 rm -f "./client/dist/en-US/stats.json"
68 rm -f "./client/dist/embed-stats.json"
70 # Creating the archives
73 directories_to_archive
=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \
74 "$directory_name/LICENSE" "$directory_name/README.md" \
75 "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \
76 "$directory_name/client/package.json" "$directory_name/config" \
77 "$directory_name/dist" "$directory_name/package.json" \
78 "$directory_name/scripts" "$directory_name/support" \
79 "$directory_name/yarn.lock")
83 ln -s "PeerTube" "$directory_name"
85 # archive creation + signing
86 zip -9 -r "PeerTube/$zip_name" "${directories_to_archive[@]}"
87 gpg
--armor --detach-sign -u "$maintainer_public_key" "PeerTube/$zip_name"
88 XZ_OPT
="-e9 -T0" tar cfJ
"PeerTube/$tar_name" "${directories_to_archive[@]}"
89 gpg
--armor --detach-sign -u "$maintainer_public_key" "PeerTube/$tar_name"
91 # temporary setup destruction
95 # Creating the release on GitHub, with the created archives
99 if [ -z "$github_prerelease_option" ]; then
100 github
-release release
--user chocobozzz
--repo peertube
--tag "$version" --name "$version" --description "$changelog"
102 github
-release release
--user chocobozzz
--repo peertube
--tag "$version" --name "$version" --description "$changelog" "$github_prerelease_option"
105 github
-release upload
--user chocobozzz
--repo peertube
--tag "$version" --name "$zip_name" --file "$zip_name"
106 github
-release upload
--user chocobozzz
--repo peertube
--tag "$version" --name "$zip_name.asc" --file "$zip_name.asc"
107 github
-release upload
--user chocobozzz
--repo peertube
--tag "$version" --name "$tar_name" --file "$tar_name"
108 github
-release upload
--user chocobozzz
--repo peertube
--tag "$version" --name "$tar_name.asc" --file "$tar_name.asc"
110 git push origin
"$branch"
112 # Only update master if it is not a pre release
113 if [ -z "$github_prerelease_option" ]; then
114 # Update master branch
117 git push origin master
118 git checkout
"$branch"
122 # Release types package
123 npm run generate
-types-package
125 npm publish
--access public