nightly.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. today=$(date '+%F')
  13. directory_name="peertube-nightly-$today"
  14. tar_name="peertube-nightly-$today.tar.xz"
  15. npm run build
  16. nightly_version="nightly-$today"
  17. sed -i 's/"version": "\([^"]\+\)"/"version": "\1-'"$nightly_version"'"/' ./package.json
  18. # Creating the archives
  19. (
  20. # local variables
  21. directories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \
  22. "$directory_name/LICENSE" "$directory_name/README.md" \
  23. "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \
  24. "$directory_name/client/package.json" "$directory_name/config" \
  25. "$directory_name/dist" "$directory_name/package.json" \
  26. "$directory_name/scripts" "$directory_name/support" \
  27. "$directory_name/tsconfig.json" "$directory_name/yarn.lock")
  28. # temporary setup
  29. cd ..
  30. ln -s "PeerTube" "$directory_name"
  31. XZ_OPT=-e9 tar cfJ "PeerTube/$tar_name" "${directories_to_archive[@]}"
  32. # temporary setup destruction
  33. rm "$directory_name"
  34. )
  35. git checkout -- ./package.json