From 9905012cd7328c71fc41da9c6a23b23bd0856ff7 Mon Sep 17 00:00:00 2001 From: Gerhard Burger Date: Thu, 1 May 2025 19:17:16 +0200 Subject: [PATCH] Add build time var (#4167) --- ct/homepage.sh | 10 ++++++++++ install/homepage-install.sh | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ct/homepage.sh b/ct/homepage.sh index 8c68913dd..f9381512d 100644 --- a/ct/homepage.sh +++ b/ct/homepage.sh @@ -35,6 +35,15 @@ function update_script() { echo "Installed NPM..." fi fi + # ensure that jq is installed + if ! command -v jq &>/dev/null; then + $STD msg_info "Installing jq..." + $STD apt-get update -qq &>/dev/null + $STD apt-get install -y jq &>/dev/null || { + msg_error "Failed to install jq" + exit + } + fi LOCAL_IP=$(hostname -I | awk '{print $1}') RELEASE=$(curl -fsSL https://api.github.com/repos/gethomepage/homepage/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then @@ -50,6 +59,7 @@ function update_script() { $STD npx --yes update-browserslist-db@latest export NEXT_PUBLIC_VERSION="v$RELEASE" export NEXT_PUBLIC_REVISION="source" + export NEXT_PUBLIC_BUILDTIME=$(curl -fsSL https://api.github.com/repos/gethomepage/homepage/releases/latest | jq -r '.published_at') export NEXT_TELEMETRY_DISABLED=1 $STD pnpm build if [[ ! -f /opt/homepage/.env ]]; then diff --git a/install/homepage-install.sh b/install/homepage-install.sh index 4fdf6fdf1..526fc4ada 100644 --- a/install/homepage-install.sh +++ b/install/homepage-install.sh @@ -14,7 +14,7 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y gpg +$STD apt-get install -y gpg jq msg_ok "Installed Dependencies" msg_info "Setting up Node.js Repository" @@ -43,6 +43,7 @@ cp /opt/homepage/src/skeleton/* /opt/homepage/config $STD pnpm install export NEXT_PUBLIC_VERSION="v$RELEASE" export NEXT_PUBLIC_REVISION="source" +export NEXT_PUBLIC_BUILDTIME=$(curl -fsSL https://api.github.com/repos/gethomepage/homepage/releases/latest | jq -r '.published_at') export NEXT_TELEMETRY_DISABLED=1 $STD pnpm build echo "HOMEPAGE_ALLOWED_HOSTS=localhost:3000,${LOCAL_IP}:3000" >/opt/homepage/.env