49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
name: Build and Deploy Documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Publish to Pages
|
|
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
ORG_REPO='${{ gitea.repository }}'
|
|
case "$ORG_REPO" in
|
|
*/*) ;;
|
|
*) echo "invalid repository slug: $ORG_REPO" >&2; exit 1 ;;
|
|
esac
|
|
case "$ORG_REPO" in
|
|
*..*|/*|*/|*//* ) echo "unsafe repository slug: $ORG_REPO" >&2; exit 1 ;;
|
|
esac
|
|
test -f build/index.html
|
|
destination="/gondor-v1-gitea-pages/$ORG_REPO"
|
|
mkdir -p "$destination"
|
|
rsync -a --delete build/ "$destination/"
|