
vercel-build.sh
SH45 lines1.4 KB
1#!/usr/bin/env bash2# Build step of the Vercel deployment, run from the website folder.3#4# With the whole repository available (a Git deployment whose root directory is `website`), it5# installs the pinned Pudu release after verifying its checksum, installs the package's6# dependencies at the repository root, and builds website/ into website/_site.7#8# With only the website folder uploaded (`vercel deploy` from website/ after a local build),9# the site in _site is already built and is published as it is.10set -euo pipefail1112here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"13root="$(dirname "$here")"1415if [ ! -f "$root/src/PuduLangDocgen.pudu" ]; then16 if [ -f "$here/_site/index.html" ]; then17 echo "Publishing the prebuilt site in website/_site."18 exit 019 fi20 echo "Neither the repository sources nor a prebuilt website/_site are available." >&221 exit 122fi2324PUDU_VERSION="0.1.2"25archive="pudu-${PUDU_VERSION}-linux-amd64.tar.gz"26base="https://github.com/chrismichaelps/pudu-lang/releases/download/v${PUDU_VERSION}"27tools="${TMPDIR:-/tmp}/pudu-toolchain"2829if [ ! -x "$tools/pudu-${PUDU_VERSION}-linux-amd64/bin/pudu" ]; then30 mkdir -p "$tools"31 (32 cd "$tools"33 curl -fsSLO "$base/$archive"34 curl -fsSLO "$base/$archive.sha256"35 sha256sum -c "$archive.sha256"36 tar -xzf "$archive"37 )38fi39export PATH="$tools/pudu-${PUDU_VERSION}-linux-amd64/bin:$PATH"4041cd "$root"42pudu version43pudu install44pudu run examples/Cli.pudu build website45