commit: fb843ded2b35b7f9ea92d981617742338dd25d5c
parent: 6249b489300ea5261da9e341a5b23744fb0e7790
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 3 Feb 2019 15:13:16 +0100
download-mastofe-build.sh: New script
Diffstat:
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/download-mastofe-build.sh b/download-mastofe-build.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+project_id="74"
+project_branch="rebase/glitch-soc"
+static_dir="instance/static"
+
+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-)"
+
+echo "branch:${project_branch}"
+echo "Last-Modified:${last_modified}"
+
+artifact="mastofe.zip"
+
+if [[ -e mastofe.timestamp ]] && [[ "${last_modified}" != "" ]]
+then
+ if [[ "$(cat mastofe.timestamp)" == "${last_modified}" ]]
+ then
+ echo "MastoFE is up-to-date, exiting…"
+ exit 0
+ fi
+fi
+
+curl -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
+
+rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit
+unzip -q "${artifact}" || exit
+
+cp public/assets/sw.js "${static_dir}/sw.js" || exit
+cp -r public/packs "${static_dir}/packs" || exit
+
+echo "${last_modified}" > mastofe.timestamp
+rm -fr public
+rm -i "${artifact}"