73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
name: Publish Docs
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "docs/**"
|
|
- "scripts/generate-docs-index.mjs"
|
|
- ".github/workflows/docs-pages.yml"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: "docs-pages"
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
PAGES_REPOSITORY: dirtydishes/dirtydishes.github.io
|
|
PAGES_BRANCH: master
|
|
PAGES_PREFIX: islandflow
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Build docs index
|
|
run: node scripts/generate-docs-index.mjs
|
|
|
|
- name: Prepare static site payload
|
|
run: |
|
|
rm -rf site
|
|
mkdir -p site/docs
|
|
cp -R docs/. site/docs/
|
|
printf '%s\n' '<!doctype html><meta charset="utf-8"><meta http-equiv="refresh" content="0; url=https://dirtydishes.github.io/islandflow/docs/"><title>Islandflow Docs</title><a href="https://dirtydishes.github.io/islandflow/docs/">Continue to docs</a>' > site/index.html
|
|
touch site/.nojekyll
|
|
|
|
- name: Checkout GitHub Pages site
|
|
uses: actions/checkout@v5
|
|
with:
|
|
repository: ${{ env.PAGES_REPOSITORY }}
|
|
ref: ${{ env.PAGES_BRANCH }}
|
|
token: ${{ secrets.DOCS_PAGES_TOKEN }}
|
|
path: pages
|
|
fetch-depth: 0
|
|
|
|
- name: Mirror docs into Pages site
|
|
run: |
|
|
set -euo pipefail
|
|
rm -rf "pages/${PAGES_PREFIX}"
|
|
mkdir -p "pages/${PAGES_PREFIX}"
|
|
cp -R site/. "pages/${PAGES_PREFIX}/"
|
|
touch pages/.nojekyll
|
|
|
|
- name: Commit and push Pages mirror
|
|
run: |
|
|
set -euo pipefail
|
|
cd pages
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add "${PAGES_PREFIX}" .nojekyll
|
|
|
|
if git diff --cached --quiet; then
|
|
echo "No docs changes to publish."
|
|
exit 0
|
|
fi
|
|
|
|
git commit -m "publish islandflow docs from ${GITHUB_SHA}"
|
|
git push origin "HEAD:${PAGES_BRANCH}"
|