use custom site-builder oci image
Some checks failed
Deploy website to VPS / build-and-deploy (push) Failing after 19s

This commit is contained in:
Evan Scamehorn
2026-01-08 19:10:52 -06:00
parent 4cdafa8d2b
commit 79e4593db3

View File

@@ -1,9 +1,5 @@
name: Deploy website to VPS name: Deploy website to VPS
env:
NODE_VERSION: '20'
HUGO_VERSION: '0.121.0' # Fallback version
on: on:
push: push:
branches: ['main'] branches: ['main']
@@ -11,40 +7,19 @@ on:
jobs: jobs:
build-and-deploy: build-and-deploy:
runs-on: debian-latest runs-on: site-builder
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install System Dependencies
run: |
apt-get update
apt-get install -y rsync openssh-client git ca-certificates
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Setup pnpm
if: hashFiles('package.json') != ''
uses: pnpm/action-setup@v4
- name: Get Hugo Version - name: Get Hugo Version
run: | run: |
if [ -f "hugoblox.yaml" ]; then if [ -f "hugoblox.yaml" ]; then
# Extract version from your config file
VERSION=$(grep "hugo_version" hugoblox.yaml | awk '{print $2}' | tr -d "'\"") VERSION=$(grep "hugo_version" hugoblox.yaml | awk '{print $2}' | tr -d "'\"")
echo "HUGO_VERSION=$VERSION" >> $GITHUB_ENV echo "HUGO_VERSION=$VERSION" >> $GITHUB_ENV
else else
# Fallback if file doesn't exist
echo "HUGO_VERSION=0.125.0" >> $GITHUB_ENV echo "HUGO_VERSION=0.125.0" >> $GITHUB_ENV
fi fi
@@ -54,17 +29,11 @@ jobs:
pnpm install --no-frozen-lockfile || npm install pnpm install --no-frozen-lockfile || npm install
fi fi
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Build with Hugo - name: Build with Hugo
env: env:
HUGO_ENVIRONMENT: production HUGO_ENVIRONMENT: production
run: | run: |
# Replace with your actual domain # Use the baked-in hugo binary
hugo --minify --baseURL "https://ejs.cam/" hugo --minify --baseURL "https://ejs.cam/"
- name: Generate Pagefind search index - name: Generate Pagefind search index
@@ -80,19 +49,14 @@ jobs:
REMOTE_USER: ${{ secrets.REMOTE_USER }} REMOTE_USER: ${{ secrets.REMOTE_USER }}
REMOTE_PORT: ${{ secrets.REMOTE_PORT }} REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
run: | run: |
# 1. Prepare SSH Directory
mkdir -p ~/.ssh mkdir -p ~/.ssh
chmod 700 ~/.ssh chmod 700 ~/.ssh
# 2. Load the Private Key
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
# 3. Add host to known_hosts to prevent interactive prompt
ssh-keyscan -p "$REMOTE_PORT" "$REMOTE_HOST" >> ~/.ssh/known_hosts ssh-keyscan -p "$REMOTE_PORT" "$REMOTE_HOST" >> ~/.ssh/known_hosts
# 4. Sync files to NixOS /var/www
# Note: the trailing slash on ./public/ means "contents of public"
rsync -avz --delete \ rsync -avz --delete \
--exclude 'cv.pdf' \ --exclude 'cv.pdf' \
--omit-dir-times \ --omit-dir-times \