From b421dd3dd23fd2df6086bcad1d46a4262f259459 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 12 Apr 2019 07:32:46 +0200 Subject: [PATCH] installation/download-mastofe-build.sh: Add mastofe CI-artifacts download [ci skip] --- installation/download-mastofe-build.sh | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 installation/download-mastofe-build.sh diff --git a/installation/download-mastofe-build.sh b/installation/download-mastofe-build.sh new file mode 100755 index 000000000..ab31a7ee7 --- /dev/null +++ b/installation/download-mastofe-build.sh @@ -0,0 +1,42 @@ +#!/bin/sh +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}"