Skip to content

Commit 470d632

Browse files
committed
will this fix it?
1 parent 6a1b88f commit 470d632

2 files changed

Lines changed: 73 additions & 4 deletions

File tree

build.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
3+
#------------------------------------------------------------------------------
4+
# @file
5+
# Builds a Hugo site hosted on Vercel.
6+
#
7+
# The Vercel build image automatically installs Node.js dependencies.
8+
#------------------------------------------------------------------------------
9+
10+
main() {
11+
12+
DART_SASS_VERSION=1.92.1
13+
GO_VERSION=1.25.1
14+
HUGO_VERSION=0.150.0
15+
NODE_VERSION=22.18.0
16+
17+
export TZ=Europe/Oslo
18+
19+
# Install Dart Sass
20+
echo "Installing Dart Sass ${DART_SASS_VERSION}..."
21+
curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
22+
tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
23+
rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
24+
export PATH="${HOME}/.local/dart-sass:${PATH}"
25+
26+
# Install Go
27+
echo "Installing Go ${GO_VERSION}..."
28+
curl -sLJO "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz"
29+
tar -C "${HOME}/.local" -xf "go${GO_VERSION}.linux-amd64.tar.gz"
30+
rm "go${GO_VERSION}.linux-amd64.tar.gz"
31+
export PATH="${HOME}/.local/go/bin:${PATH}"
32+
33+
# Install Hugo
34+
echo "Installing Hugo ${HUGO_VERSION}..."
35+
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
36+
mkdir "${HOME}/.local/hugo"
37+
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
38+
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
39+
export PATH="${HOME}/.local/hugo:${PATH}"
40+
41+
# Install Node.js
42+
echo "Installing Node.js ${NODE_VERSION}..."
43+
curl -sLJO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"
44+
tar -C "${HOME}/.local" -xf "node-v${NODE_VERSION}-linux-x64.tar.xz"
45+
rm "node-v${NODE_VERSION}-linux-x64.tar.xz"
46+
export PATH="${HOME}/.local/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
47+
48+
# Verify installations
49+
echo "Verifying installations..."
50+
echo Dart Sass: "$(sass --version)"
51+
echo Go: "$(go version)"
52+
echo Hugo: "$(hugo version)"
53+
echo Node.js: "$(node --version)"
54+
55+
# Configure Git
56+
echo "Configuring Git..."
57+
git config core.quotepath false
58+
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
59+
git fetch --unshallow
60+
fi
61+
62+
# Build the site
63+
echo "Building the site"
64+
hugo --gc --minify --baseURL "https://${VERCEL_PROJECT_PRODUCTION_URL}"
65+
66+
}
67+
68+
set -euo pipefail
69+
main "$@"

vercel.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"env": {
3-
"HUGO_VERSION": "1.50.1"
4-
}
5-
}
2+
"$schema": "https://openapi.vercel.sh/vercel.json",
3+
"buildCommand": "chmod a+x build.sh && ./build.sh",
4+
"outputDirectory": "public"
5+
}

0 commit comments

Comments
 (0)