mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-09-12 21:37:53 -04:00
74 lines
1.9 KiB
YAML
74 lines
1.9 KiB
YAML
name: Deploy Docusaurus to GitHub Pages
|
|
|
|
on:
|
|
workflow_call: {}
|
|
workflow_dispatch: {}
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
ref: main
|
|
persist-credentials: false
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 26.x
|
|
cache: yarn
|
|
cache-dependency-path: docs/yarn.lock
|
|
|
|
- name: Install dependencies
|
|
working-directory: docs
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Build Docusaurus
|
|
working-directory: docs
|
|
run: yarn build
|
|
|
|
- name: Publish to org site
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
personal_token: ${{ secrets.DOCS_DEPLOY_TOKEN }}
|
|
external_repository: Cleanuparr/Cleanuparr.github.io
|
|
publish_branch: gh-pages
|
|
publish_dir: docs/build
|
|
|
|
redirect:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Build redirect stub
|
|
run: |
|
|
mkdir redirect
|
|
cat > redirect/404.html <<'EOF'
|
|
<!doctype html>
|
|
<meta http-equiv="refresh" content="0;url=https://cleanuparr.github.io/docs">
|
|
<script>
|
|
var p = location.pathname.replace(/^\/Cleanuparr/, '');
|
|
location.replace('https://cleanuparr.github.io' + p + location.search + location.hash);
|
|
</script>
|
|
EOF
|
|
cp redirect/404.html redirect/index.html
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v5
|
|
with:
|
|
path: redirect
|
|
retention-days: 1
|
|
|
|
- name: Deploy redirect to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v5
|