@@ -9,63 +9,64 @@ on:
99 paths: ['docs/**']
1010
1111jobs:
12− checks:
13− if: github.event_name != 'push'
12+ pull-request-check:
13+ if: github.event_name == 'pull_request'
1414 runs-on: ubuntu-latest
1515 steps:
16− - uses: actions/checkout@v3
17− - uses: actions/setup-node@v1
16+ - uses: actions/checkout@v4
17+
18+ - uses: actions/setup-node@v3
1819 with:
19− node-version: '17.x'
20+ node-version: 18
21+
2022 - name: Test Build
2123 working-directory: ./docs
22− env:
23− NODE_OPTIONS: --openssl-legacy-provider
2424 run: |
25− if [ -e yarn.lock ]; then
26− yarn install --frozen-lockfile
27− elif [ -e package-lock.json ]; then
2825 npm ci
29− else
30− npm i
31− fi
3226 npm run build
33− gh-release:
34− if: github.event_name != 'pull_request'
27+
28+ gh-pages-release:
29+ if: github.event_name == 'push'
3530 runs-on: ubuntu-latest
31+ permissions:
32+ contents: write
3633 steps:
37− - uses: actions/checkout@v3
38− - uses: actions/setup-node@v1
34+ - uses: actions/checkout@v4
3935 with:
40− node-version: '17.x'
41− - name: Add key to allow access to repository
42− env:
43− SSH_AUTH_SOCK: /tmp/ssh_agent.sock
44− NODE_OPTIONS: --openssl-legacy-provider
36+ path: master
37+
38+ - uses: actions/checkout@v4
39+ with:
40+ ref: gh-pages
41+ path: gh-pages
42+
43+ - uses: actions/setup-node@v3
44+ with:
45+ node-version: 18
46+
47+ - name: Build docusaurus
48+ working-directory: master/docs
49+ id: build
4550 run: |
46− mkdir -p ~/.ssh
47− ssh-keyscan github.com >> ~/.ssh/known_hosts
48− echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
49− chmod 600 ~/.ssh/id_rsa
50− cat <<EOT >> ~/.ssh/config
51− Host github.com
52− HostName github.com
53− IdentityFile ~/.ssh/id_rsa
54− EOT
55− - name: Release to GitHub Pages
56− working-directory: ./docs
51+ echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
52+ npm ci
53+ npm run build
54+
55+ - name: Release to github pages
5756 env:
58− USE_SSH: true
59− GIT_USER: git
60− NODE_OPTIONS: --openssl-legacy-provider
57+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+ working-directory: gh-pages
6159 run: |
62− git config --global user.email "actions@gihub.com"
63− git config --global user.name "gh-actions"
64− if [ -e yarn.lock ]; then
65− yarn install --frozen-lockfile
66− elif [ -e package-lock.json ]; then
67− npm ci
68− else
69− npm i
70− fi
71− npx docusaurus deploy
60+ git config --local user.name "github-actions[bot]"
61+ git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
62+
63+ # Remove all files except .git
64+ git rm -r *
65+
66+ # Copy the build files from master/docs/build to gh-pages
67+ cp -r ../master/docs/build/* .
68+
69+ # Commit and push
70+ git add .
71+ git commit -m "Update documentation based on ${{ steps.build.outputs.sha }}"
72+ git push origin gh-pages