2019-04-12 07:32:46 +02:00
|
|
|
|
#!/bin/sh
|
2019-04-12 07:39:49 +02:00
|
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-13 07:49:20 +01:00
|
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2019-04-12 07:39:49 +02:00
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
2019-04-12 07:32:46 +02:00
|
|
|
|
project_id="74"
|
|
|
|
|
project_branch="rebase/glitch-soc"
|
|
|
|
|
static_dir="instance/static"
|
|
|
|
|
# For bundling:
|
|
|
|
|
# project_branch="pleroma"
|
|
|
|
|
# static_dir="priv/static"
|
|
|
|
|
|
2020-12-08 23:46:13 +01:00
|
|
|
|
if [ ! -d "${static_dir}" ]
|
2019-04-12 07:32:46 +02:00
|
|
|
|
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
|
|
|
|
|
|
2020-12-08 23:46:13 +01:00
|
|
|
|
last_modified="$(curl --fail -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)"
|
2019-04-12 07:32:46 +02:00
|
|
|
|
|
|
|
|
|
echo "branch:${project_branch}"
|
|
|
|
|
echo "Last-Modified:${last_modified}"
|
|
|
|
|
|
|
|
|
|
artifact="mastofe.zip"
|
|
|
|
|
|
2020-12-08 23:46:13 +01:00
|
|
|
|
if [ "${last_modified}x" = "x" ]
|
2019-04-12 07:32:46 +02:00
|
|
|
|
then
|
2020-12-08 23:46:13 +01:00
|
|
|
|
echo "ERROR: Couldn't get the modification date of the latest build archive, maybe it expired, exiting..."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -e mastofe.timestamp ] && [ "$(cat mastofe.timestamp)" = "${last_modified}" ]
|
|
|
|
|
then
|
|
|
|
|
echo "MastoFE is up-to-date, exiting..."
|
|
|
|
|
exit 0
|
2019-04-12 07:32:46 +02:00
|
|
|
|
fi
|
|
|
|
|
|
2020-12-08 23:46:13 +01:00
|
|
|
|
curl --fail -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
|
2019-04-12 07:32:46 +02:00
|
|
|
|
|
|
|
|
|
# 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}"
|