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