]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - scripts/release.sh
Remove uneeded rxjs-compat
[github/Chocobozzz/PeerTube.git] / scripts / release.sh
... / ...
CommitLineData
1#!/bin/bash
2
3set -eu
4
5shutdown() {
6 # Get our process group id
7 # shellcheck disable=SC2009
8 PGID=$(ps -o pgid= $$ | grep -o "[0-9]*")
9
10 # Kill it in a new new process group
11 setsid kill -- -"$PGID"
12 exit 0
13}
14
15trap "shutdown" SIGINT SIGTERM
16
17if [ -z "$1" ]; then
18 echo "Need version as argument"
19 exit -1
20fi
21
22if [ -z "$GITHUB_TOKEN" ]; then
23 echo "Need GITHUB_TOKEN env set."
24 exit -1
25fi
26
27branch=$(git symbolic-ref --short -q HEAD)
28if [ "$branch" != "develop" ]; then
29 echo "Need to be on develop branch."
30 exit -1
31fi
32
33version="v$1"
34directory_name="peertube-$version"
35zip_name="peertube-$version.zip"
36tar_name="peertube-$version.tar.xz"
37
38changelog=$(awk -v version="$version" '/## v/ { printit = $2 == version }; printit;' CHANGELOG.md | grep -v "$version" | sed '1{/^$/d}')
39
40printf "Changelog will be:\\n%s\\n" "$changelog"
41
42read -p "Are you sure to release? " -n 1 -r
43echo
44if [[ ! $REPLY =~ ^[Yy]$ ]]
45then
46 exit 0
47fi
48
49(
50 cd client
51 npm version --no-git-tag-version --no-commit-hooks "$1"
52)
53
54npm version -f --no-git-tag-version --no-commit-hooks "$1"
55
56git commit package.json client/package.json -m "Bumped to version $version"
57git tag -s -a "$version" -m "$version"
58
59npm run build
60rm "./client/dist/en_US/stats.json"
61rm "./client/dist/embed-stats.json"
62
63# Creating the archives
64(
65 # local variables
66 directories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \
67 "$directory_name/LICENSE" "$directory_name/README.md" \
68 "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \
69 "$directory_name/client/package.json" "$directory_name/config" \
70 "$directory_name/dist" "$directory_name/package.json" \
71 "$directory_name/scripts" "$directory_name/support" \
72 "$directory_name/tsconfig.json" "$directory_name/yarn.lock")
73 maintainer_public_key="583A612D890159BE"
74
75 # temporary setup
76 cd ..
77 ln -s "PeerTube" "$directory_name"
78
79 # archive creation + signing
80 zip -r "PeerTube/$zip_name" "${directories_to_archive[@]}"
81 gpg --armor --detach-sign -u "$maintainer_public_key" "PeerTube/$zip_name"
82 XZ_OPT=-e9 tar cfJ "PeerTube/$tar_name" "${directories_to_archive[@]}"
83 gpg --armor --detach-sign -u "$maintainer_public_key" "PeerTube/$tar_name"
84
85 # temporary setup destruction
86 rm "$directory_name"
87)
88
89# Creating the release on GitHub, with the created archives
90(
91 git push origin --tag
92
93 github-release release --user chocobozzz --repo peertube --tag "$version" --name "$version" --description "$changelog"
94 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$zip_name" --file "$zip_name"
95 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$zip_name.asc" --file "$zip_name.asc"
96 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$tar_name" --file "$tar_name"
97 github-release upload --user chocobozzz --repo peertube --tag "$version" --name "$tar_name.asc" --file "$tar_name.asc"
98
99 git push origin develop
100
101 # Update master branch
102 git checkout master
103 git rebase develop
104 git push origin master
105 git checkout develop
106)