@@ -3,7 +3,7 @@ name: Dotty the Documenteer
33on :
44 push :
55 branches :
6- - master
6+ - doc
77 paths :
88 - ' doc/**'
99 - ' README.md'
1919
2020permissions :
2121 contents : read
22- pages : write
23- id-token : write
24-
25- concurrency :
26- group : " pages"
27- cancel-in-progress : false
2822
2923jobs :
3024 build :
@@ -48,21 +42,47 @@ jobs:
4842 pipx inject mkdocs mkdocs-callouts
4943
5044 - name : Build documentation
51- run : mkdocs build
45+ run : mkdocs build --clean
5246
53- - name : Upload Pages artifact
54- uses : actions/upload-pages- artifact@v3
47+ - name : Upload site artifact
48+ uses : actions/upload-artifact@v4
5549 with :
50+ name : site
5651 path : site/
5752
5853 deploy :
59- if : github.ref == 'refs/heads/master ' && github.event_name == 'push'
54+ if : github.ref == 'refs/heads/doc ' && github.event_name == 'push'
6055 needs : build
6156 runs-on : ubuntu-latest
62- environment :
63- name : github-pages
64- url : ${{ steps.deployment.outputs.page_url }}
57+
6558 steps :
66- - name : Deploy to GitHub Pages
67- id : deployment
68- uses : actions/deploy-pages@v4
59+ - name : Download site artifact
60+ uses : actions/download-artifact@v4
61+ with :
62+ name : site
63+ path : site/
64+
65+ - name : Checkout pages repo
66+ uses : actions/checkout@v4
67+ with :
68+ repository : finit-project/finit-project.github.io
69+ path : pages
70+ ssh-key : ${{ secrets.DOCS_DEPLOY_KEY }}
71+
72+ - name : Sync site to pages repo
73+ run : |
74+ rsync -a --delete site/ pages/
75+
76+ - name : Commit and push
77+ run : |
78+ cd pages
79+
80+ if [ -z "$(git status --porcelain)" ]; then
81+ exit 0
82+ fi
83+
84+ git config user.name "GitHub Actions"
85+ git config user.email "[email protected] " 86+ git add .
87+ git commit -m "docs: update"
88+ git push
0 commit comments