nightly.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 -- --source-map
  16. # Clean up declaration files
  17. find dist/ packages/core-utils/dist/ \
  18. packages/ffmpeg/dist/ \
  19. packages/node-utils/dist/ \
  20. packages/models/dist/ \
  21. \( -name '*.d.ts' -o -name '*.d.ts.map' \) -type f -delete
  22. nightly_version="nightly-$today"
  23. sed -i 's/"version": "\([^"]\+\)"/"version": "\1-'"$nightly_version"'"/' ./package.json
  24. # Creating the archives
  25. (
  26. # local variables
  27. directories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \
  28. "$directory_name/LICENSE" "$directory_name/README.md" \
  29. "$directory_name/packages/core-utils/dist/" "$directory_name/packages/core-utils/package.json" \
  30. "$directory_name/packages/ffmpeg/dist/" "$directory_name/packages/ffmpeg/package.json" \
  31. "$directory_name/packages/node-utils/dist/" "$directory_name/packages/node-utils/package.json" \
  32. "$directory_name/packages/models/dist/" "$directory_name/packages/models/package.json" \
  33. "$directory_name/packages/transcription/dist/" "$directory_name/packages/transcription/package.json" \
  34. "$directory_name/client/dist/" "$directory_name/client/yarn.lock" \
  35. "$directory_name/client/package.json" "$directory_name/config" \
  36. "$directory_name/dist" "$directory_name/package.json" \
  37. "$directory_name/scripts/upgrade.sh" "$directory_name/support" \
  38. "$directory_name/yarn.lock")
  39. # temporary setup
  40. cd ..
  41. ln -s "PeerTube" "$directory_name"
  42. XZ_OPT=-e9 tar cfJ "PeerTube/$tar_name" "${directories_to_archive[@]}"
  43. # temporary setup destruction
  44. rm "$directory_name"
  45. )
  46. git checkout -- ./package.json