Federated video streaming platform using ActivityPub and P2P in the web browser with Angular. https://joinpeertube.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

126 lines
3.9 KiB

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