summaryrefslogtreecommitdiff
path: root/installation
diff options
context:
space:
mode:
authorlambda <lain@soykaf.club>2019-05-01 10:48:30 +0000
committerlambda <lain@soykaf.club>2019-05-01 10:48:30 +0000
commita58813e7a14fda8eff2f2a659094444d20765e85 (patch)
treec7317e01ae20a53ff1f3913f54a722fe9972df1b /installation
parent0bcdaf378ee41c3845151b59d8820b799532c9a8 (diff)
parent378b964d8eba2f216fa6f670c2de42ecee0c6277 (diff)
Merge branch 'features/download-mastofe-build' into 'develop'
installation/download-mastofe-build.sh: Add mastofe CI-artifacts download See merge request pleroma/pleroma!1052
Diffstat (limited to 'installation')
-rwxr-xr-xinstallation/download-mastofe-build.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/installation/download-mastofe-build.sh b/installation/download-mastofe-build.sh
new file mode 100755
index 000000000..7e293867d
--- /dev/null
+++ b/installation/download-mastofe-build.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+project_id="74"
+project_branch="rebase/glitch-soc"
+static_dir="instance/static"
+# For bundling:
+# project_branch="pleroma"
+# static_dir="priv/static"
+
+if [[ ! -d "${static_dir}" ]]
+then
+ echo "Error: ${static_dir} directory is missing, are you sure you are running this script at the root of pleroma’s repository?"
+ exit 1
+fi
+
+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
+
+# TODO: Update the emoji as well
+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}"