Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
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.

46 lines
1.4KB

  1. #!/bin/sh
  2. # Pleroma: A lightweight social networking server
  3. # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
  4. # SPDX-License-Identifier: AGPL-3.0-only
  5. project_id="74"
  6. project_branch="rebase/glitch-soc"
  7. static_dir="instance/static"
  8. # For bundling:
  9. # project_branch="pleroma"
  10. # static_dir="priv/static"
  11. if [[ ! -d "${static_dir}" ]]
  12. then
  13. echo "Error: ${static_dir} directory is missing, are you sure you are running this script at the root of pleroma’s repository?"
  14. exit 1
  15. fi
  16. last_modified="$(curl -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)"
  17. echo "branch:${project_branch}"
  18. echo "Last-Modified:${last_modified}"
  19. artifact="mastofe.zip"
  20. if [[ -e mastofe.timestamp ]] && [[ "${last_modified}" != "" ]]
  21. then
  22. if [[ "$(cat mastofe.timestamp)" == "${last_modified}" ]]
  23. then
  24. echo "MastoFE is up-to-date, exiting…"
  25. exit 0
  26. fi
  27. fi
  28. curl -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
  29. # TODO: Update the emoji as well
  30. rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit
  31. unzip -q "${artifact}" || exit
  32. cp public/assets/sw.js "${static_dir}/sw.js" || exit
  33. cp -r public/packs "${static_dir}/packs" || exit
  34. echo "${last_modified}" > mastofe.timestamp
  35. rm -fr public
  36. rm -i "${artifact}"