66 branches :
77 - master
88 pull_request :
9+ schedule :
10+ - cron : ' 0 0 * * *' # Daily at midnight UTC
911
1012concurrency :
1113 group : ${{ github.workflow }}-${{ github.ref }}
2527 node-version : ' 24'
2628
2729 - name : Install dependencies
28- run : npm install
30+ run : npm install --ignore-scripts
2931
3032 - name : Validate JSON files
3133 run : npm run validate
@@ -36,23 +38,41 @@ jobs:
3638 - name : Build indexes
3739 run : npm run build
3840
39- - name : Upload pages artifacts
40- uses : actions/upload-pages- artifact@v4
41+ - name : Upload dist artifacts
42+ uses : actions/upload-artifact@v6
4143 with :
42- name : github-pages
44+ if-no-files-found : ' error'
45+ name : dist
4346 path : dist/
4447
45- deploy :
48+ publish :
4649 needs : build
47- if : github.event_name == 'push' && github.ref == 'refs/heads/master'
50+ if : ( github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'schedule '
4851 runs-on : ubuntu-latest
4952 permissions :
50- pages : write # to deploy to Pages
51- id-token : write # to verify the deployment originates from an appropriate source
52- environment :
53- name : github-pages
54- url : ${{ steps.deployment.outputs.page_url }}
53+ contents : read
5554 steps :
56- - name : Deploy to GitHub Pages
57- id : deployment
58- uses : actions/deploy-pages@v4
55+ - name : Download dist artifacts
56+ uses : actions/download-artifact@v7
57+ with :
58+ name : dist
59+ path : dist/
60+
61+ - name : Publish to dist branch
62+ env :
63+ GH_BOT_NAME : ${{ secrets.GH_BOT_NAME }}
64+ GH_BOT_EMAIL : ${{ secrets.GH_BOT_EMAIL }}
65+ GH_BOT_TOKEN : ${{ secrets.GH_BOT_TOKEN }}
66+ run : |
67+ git config --global user.name "${GH_BOT_NAME}"
68+ git config --global user.email "${GH_BOT_EMAIL}"
69+ git clone --single-branch --branch dist \
70+ "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo \
71+ || git clone "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo
72+ cd dist-repo
73+ git checkout dist 2>/dev/null || git checkout --orphan dist
74+ git rm -rf . 2>/dev/null || true
75+ cp -r ../dist/* .
76+ git add .
77+ git diff --staged --quiet || git commit -m "build: update dist from ${GITHUB_SHA}"
78+ git push "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist
0 commit comments