#!/usr/bin/env bash # Build the site and publish it at https://shanaty.ru/resume/ (Gitea/Caddy server). # # The text and project list are NOT baked into the build: the page reads /data/resume.json, which the # server rebuilds every minute from data/resume.json in the Gitea repo plus the repos tagged `resume`. # So redeploy only after changing code or styles; content changes just need a push to Gitea. # The site is uploaded to a temp dir and swapped in, so it is never half-updated. set -euo pipefail cd "$(dirname "$0")" HOST="${GT2GH_HOST:-root@135.106.198.222}" KEY="${GT2GH_KEY:-$HOME/.ssh/MyGitea}" SITE_DIR=/opt/gitea/site [ -r "$KEY" ] || { echo "deploy: ssh key not found: $KEY" >&2; exit 1; } rm -rf .next out BASE_PATH=/resume NEXT_PUBLIC_DATA_URL=/data/resume.json NEXT_PUBLIC_SITE_ORIGIN= npm run build [ -f out/index.html ] || { echo "deploy: build failed (out/index.html missing)" >&2; exit 1; } tar -C out -c . | ssh -i "$KEY" -o IgnoreUnknown=WarnWeakCrypto -o WarnWeakCrypto=no "$HOST" " set -e cd $SITE_DIR rm -rf .resume.new .resume.old mkdir .resume.new tar -x -C .resume.new --no-same-owner chmod -R a+rX .resume.new if [ -d resume ]; then mv resume .resume.old; fi mv .resume.new resume rm -rf .resume.old " echo "Deployed: https://shanaty.ru/resume/"