logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

download-mastofe-build.sh (985B)


      1 #!/bin/sh
      2 project_id="74"
      3 project_branch="rebase/glitch-soc"
      4 static_dir="instance/static"
      5 
      6 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-)"
      7 
      8 echo "branch:${project_branch}"
      9 echo "Last-Modified:${last_modified}"
     10 
     11 artifact="mastofe.zip"
     12 
     13 if [[ -e mastofe.timestamp ]] && [[ "${last_modified}" != "" ]]
     14 then
     15 	if [[ "$(cat mastofe.timestamp)" == "${last_modified}" ]]
     16 	then
     17 		echo "MastoFE is up-to-date, exiting…"
     18 		exit 0
     19 	fi
     20 fi
     21 
     22 curl -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
     23 
     24 rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit
     25 unzip -q "${artifact}" || exit
     26 
     27 cp public/assets/sw.js "${static_dir}/sw.js" || exit
     28 cp -r public/packs "${static_dir}/packs" || exit
     29 
     30 echo "${last_modified}" > mastofe.timestamp
     31 rm -fr public
     32 rm -i "${artifact}"