mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-26 10:27:32 +00:00
84 lines
2.9 KiB
YAML
84 lines
2.9 KiB
YAML
name: Documentation
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: "pages-${{ github.ref }}"
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
docs:
|
|
name: Build and Deploy Documentation
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Sync repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
|
|
- name: Detect runner environment
|
|
id: runner-env
|
|
uses: https://forgejo.ellis.link/continuwuation/detect-versions@d39555789fed25b8eb8e086d9f199c514dfa311e # v1
|
|
|
|
- name: Setup Go
|
|
if: steps.runner-env.outputs.go_minor == '' || steps.runner-env.outputs.go_minor < '27'
|
|
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7
|
|
with:
|
|
go-version: '1.27'
|
|
go-version-file: 'go.mod'
|
|
cache-dependency-path: 'go.sum'
|
|
|
|
- name: Setup Node.js
|
|
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
|
|
uses: https://github.com/actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
|
|
with:
|
|
node-version: 26
|
|
|
|
- name: Cache npm dependencies
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
|
with:
|
|
path: ~/.npm
|
|
key: continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-${{ hashFiles('package-lock.json') }}
|
|
restore-keys: |
|
|
continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-
|
|
continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-
|
|
|
|
- name: Install Rspress and dependencies
|
|
run: npm ci
|
|
|
|
- name: Build documentation with Rspress
|
|
env:
|
|
SITE_PATH: ${{ github.ref != 'refs/heads/main' && format('/@{0}/', forgejo.event.number) || '/' }}
|
|
run: npm run docs:build
|
|
|
|
- name: Deploy to Grebedoc (Production)
|
|
if: github.ref == 'refs/heads/main'
|
|
run: |
|
|
go tool git-pages-cli https://continuwuity.org \
|
|
--server grebedoc.dev \
|
|
--token "${{ forgejo.token }}" \
|
|
--upload-dir doc_build \
|
|
--pretty-urls \
|
|
--comment "${{ forgejo.sha }}" \
|
|
--verbose
|
|
|
|
- name: Deploy to Grebedoc (Preview)
|
|
if: github.ref != 'refs/heads/main'
|
|
run: |
|
|
go tool git-pages-cli https://preview.continuwuity.org/@${{ forgejo.event.number }} \
|
|
--server grebedoc.dev \
|
|
--token "${{ forgejo.token }}" \
|
|
--upload-dir doc_build \
|
|
--pretty-urls \
|
|
--expires 14 \
|
|
--comment "${{ forgejo.sha }}" \
|
|
--verbose
|