73 lines
1.7 KiB
YAML
73 lines
1.7 KiB
YAML
name: documentation
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [master]
|
|
paths: ['docs/**']
|
|
push:
|
|
branches: [master]
|
|
paths: ['docs/**']
|
|
|
|
jobs:
|
|
pull-request-check:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Test Build
|
|
working-directory: ./docs
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
gh-pages-release:
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
path: master
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: gh-pages
|
|
path: gh-pages
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Build docusaurus
|
|
working-directory: master/docs
|
|
id: build
|
|
run: |
|
|
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Release to github pages
|
|
env:
|
|
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
working-directory: gh-pages
|
|
run: |
|
|
git config --local user.name "github-actions[bot]"
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
# Remove all files except .git
|
|
git rm -r *
|
|
|
|
# Copy the build files from master/docs/build to gh-pages
|
|
cp -r ../master/docs/build/* .
|
|
|
|
# Commit and push
|
|
git add .
|
|
git commit -m "Update documentation based on ${{ steps.build.outputs.sha }}"
|
|
git push origin gh-pages
|