use custom site-builder oci image
Some checks failed
Deploy website to VPS / build-and-deploy (push) Failing after 19s
Some checks failed
Deploy website to VPS / build-and-deploy (push) Failing after 19s
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
name: Deploy website to VPS
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
HUGO_VERSION: '0.121.0' # Fallback version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
@@ -11,40 +7,19 @@ on:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: debian-latest
|
||||
runs-on: site-builder
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
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
|
||||
run: |
|
||||
if [ -f "hugoblox.yaml" ]; then
|
||||
# Extract version from your config file
|
||||
VERSION=$(grep "hugo_version" hugoblox.yaml | awk '{print $2}' | tr -d "'\"")
|
||||
echo "HUGO_VERSION=$VERSION" >> $GITHUB_ENV
|
||||
else
|
||||
# Fallback if file doesn't exist
|
||||
echo "HUGO_VERSION=0.125.0" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
@@ -54,17 +29,11 @@ jobs:
|
||||
pnpm install --no-frozen-lockfile || npm install
|
||||
fi
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: ${{ env.HUGO_VERSION }}
|
||||
extended: true
|
||||
|
||||
- name: Build with Hugo
|
||||
env:
|
||||
HUGO_ENVIRONMENT: production
|
||||
run: |
|
||||
# Replace with your actual domain
|
||||
# Use the baked-in hugo binary
|
||||
hugo --minify --baseURL "https://ejs.cam/"
|
||||
|
||||
- name: Generate Pagefind search index
|
||||
@@ -80,19 +49,14 @@ jobs:
|
||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||
REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
|
||||
run: |
|
||||
# 1. Prepare SSH Directory
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
|
||||
# 2. Load the Private Key
|
||||
echo "$SSH_PRIVATE_KEY" > ~/.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
|
||||
|
||||
# 4. Sync files to NixOS /var/www
|
||||
# Note: the trailing slash on ./public/ means "contents of public"
|
||||
rsync -avz --delete \
|
||||
--exclude 'cv.pdf' \
|
||||
--omit-dir-times \
|
||||
|
||||
Reference in New Issue
Block a user