Skip to content

Commit 9905012

Browse files
authored
Add build time var (#4167)
1 parent abfe911 commit 9905012

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ct/homepage.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ function update_script() {
3535
echo "Installed NPM..."
3636
fi
3737
fi
38+
# ensure that jq is installed
39+
if ! command -v jq &>/dev/null; then
40+
$STD msg_info "Installing jq..."
41+
$STD apt-get update -qq &>/dev/null
42+
$STD apt-get install -y jq &>/dev/null || {
43+
msg_error "Failed to install jq"
44+
exit
45+
}
46+
fi
3847
LOCAL_IP=$(hostname -I | awk '{print $1}')
3948
RELEASE=$(curl -fsSL https://api.github.com/repos/gethomepage/homepage/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
4049
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
@@ -50,6 +59,7 @@ function update_script() {
5059
$STD npx --yes update-browserslist-db@latest
5160
export NEXT_PUBLIC_VERSION="v$RELEASE"
5261
export NEXT_PUBLIC_REVISION="source"
62+
export NEXT_PUBLIC_BUILDTIME=$(curl -fsSL https://api.github.com/repos/gethomepage/homepage/releases/latest | jq -r '.published_at')
5363
export NEXT_TELEMETRY_DISABLED=1
5464
$STD pnpm build
5565
if [[ ! -f /opt/homepage/.env ]]; then

install/homepage-install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apt-get install -y gpg
17+
$STD apt-get install -y gpg jq
1818
msg_ok "Installed Dependencies"
1919

2020
msg_info "Setting up Node.js Repository"
@@ -43,6 +43,7 @@ cp /opt/homepage/src/skeleton/* /opt/homepage/config
4343
$STD pnpm install
4444
export NEXT_PUBLIC_VERSION="v$RELEASE"
4545
export NEXT_PUBLIC_REVISION="source"
46+
export NEXT_PUBLIC_BUILDTIME=$(curl -fsSL https://api.github.com/repos/gethomepage/homepage/releases/latest | jq -r '.published_at')
4647
export NEXT_TELEMETRY_DISABLED=1
4748
$STD pnpm build
4849
echo "HOMEPAGE_ALLOWED_HOSTS=localhost:3000,${LOCAL_IP}:3000" >/opt/homepage/.env

0 commit comments

Comments
 (0)