56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Build and publish Eldorado documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: eldorado-documentation-${{ gitea.ref }}
|
|
cancel-in-progress: false
|
|
|
|
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: '22'
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.15.1
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Validate source contracts
|
|
run: pnpm verify
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
- name: Build site
|
|
run: pnpm build
|
|
- name: Validate built routes, search and fonts
|
|
run: pnpm verify:build
|
|
- name: Record deployed revision
|
|
shell: bash
|
|
run: git rev-parse HEAD > build/revision.txt
|
|
- name: Publish to LEGO Cloud 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 */*) ;; *) exit 1 ;; esac
|
|
case "$ORG_REPO" in *..*|/*|*/|*//* ) exit 1 ;; esac
|
|
test "$ORG_REPO" = 'eldorado-v1/documentation'
|
|
test -f build/index.html
|
|
pages_root='/gondor-v1-gitea-pages'
|
|
mountpoint -q "$pages_root" || { echo "$pages_root is not a persistent mount" >&2; exit 1; }
|
|
destination="$pages_root/$ORG_REPO"
|
|
rm -rf -- "$destination"
|
|
mkdir -p "$destination"
|
|
cp -a build/. "$destination/"
|