44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
name: Build and deploy Docusaurus
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: homelab
|
|
|
|
steps:
|
|
- name: Bootstrap Node 20
|
|
run: |
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
apt-get update -qq
|
|
apt-get install -y -qq curl git
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
apt-get install -y -qq nodejs
|
|
elif command -v apk >/dev/null 2>&1; then
|
|
apk add --no-cache nodejs npm git
|
|
else
|
|
echo "Unsupported package manager" && exit 1
|
|
fi
|
|
node --version && npm --version && git --version
|
|
|
|
- name: Checkout
|
|
run: |
|
|
git clone http://oauth2:${{ gitea.token }}@192.168.1.18:3000/${{ gitea.repository }}.git .
|
|
git checkout ${{ gitea.sha }}
|
|
|
|
- name: Build
|
|
run: cd docs-site && npm ci && npm run build
|
|
|
|
- name: Deploy
|
|
run: |
|
|
echo "=== Running as: $(whoami) on $(hostname) ==="
|
|
echo "=== Mounts containing 'docusaurus': ==="
|
|
mount | grep docusaurus || echo "(none — host mode is NOT active)"
|
|
rm -rf /srv/www/docusaurus/*
|
|
cp -r docs-site/build/. /srv/www/docusaurus/
|
|
echo "=== Deployed files: ==="
|
|
ls /srv/www/docusaurus
|