Skip to content

Publish GitHub Pages #6

Publish GitHub Pages

Publish GitHub Pages #6

name: Publish GitHub Pages
on:
workflow_dispatch:
inputs:
version:
description: "Specify the version number for documentation"
required: true
default: "latest"
jobs:
publish:
name: Publish GitHub Pages
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Use Node.js 20.x
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Use Python 3.x
uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0
with:
python-version: "3.x"
- name: Build documentation
run: |
yarn global add node-gyp
yarn --skip-integrity-check --network-timeout 100000
yarn docs
env:
NODE_OPTIONS: --max_old_space_size=14336
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Checkout gh-pages branch
run: |
git fetch origin gh-pages
git checkout gh-pages || git checkout --orphan gh-pages
- name: Copy new documentation to gh-pages
run: |
mkdir -p docs/next
mkdir -p docs/${{ inputs.version }}
rsync -a --delete gh-pages/docs/next/ docs/next/
rsync -a --delete gh-pages/docs/${{ inputs.version }}/ docs/${{ inputs.version }}/
rsync -a ./gh-pages/docs/next/ docs/next/
rsync -a ./gh-pages/docs/${{ inputs.version }}/ docs/${{ inputs.version }}/
- name: Debug Log contents
run: |
ls -al docs
ls -al docs/next
ls -al docs/${{ inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Commit and push changes
# run: |
# git add docs/next docs/${{ inputs.version }}
# git commit -m "Update documentation for version ${{ inputs.version }}"
# git push origin gh-pages
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}