@@ -3,48 +3,54 @@ name: Docs
33on :
44 push :
55 branches : [main]
6+ pull_request :
7+ branches : [main]
68 workflow_dispatch :
79
8- permissions :
9- contents : read
10+ permissions : {}
1011
1112concurrency :
12- group : docs
13+ group : docs-${{ github.workflow }}-${{ github.ref }}
1314 cancel-in-progress : true
1415
16+ env :
17+ PYTHON_VERSION : " 3.12"
18+
1519jobs :
1620 build :
17- name : Build and deploy docs
21+ name : Build revision-identified documentation
1822 runs-on : ubuntu-latest
23+ permissions :
24+ contents : read
1925 steps :
2026 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2127 with :
22- fetch-depth : 0
23-
24- - name : Install uv
25- uses : astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
28+ persist-credentials : false
29+ - uses : astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
2630 with :
2731 version : " 0.10.9"
28-
29- - name : Set up Python
30- run : uv python install 3.12
31-
32- - name : Install dependencies
33- run : uv sync --python 3.12 --dev --extra docs
34-
35- - name : Build docs
36- run : uv run mkdocs build --strict
37-
38- - name : Deploy to website repository
39- uses : cpina/github-action-push-to-another-repository@55306faa4ed53b815ae49e564af8cfb359d32ae2 # v1.7.3
40- env :
41- SSH_DEPLOY_KEY : ${{ secrets.DOCS_DEPLOY_KEY }}
32+ - run : uv python install ${{ env.PYTHON_VERSION }}
33+ - run : uv sync --locked --python ${{ env.PYTHON_VERSION }} --dev --extra docs
34+ - name : Record source identity
35+ shell : bash
36+ run : |
37+ echo "ML4T_DOCS_VERSION=$(uv run python -c 'from ml4t.specs import __version__; print(__version__)')" >> "$GITHUB_ENV"
38+ echo "ML4T_DOCS_COMMIT=${GITHUB_SHA}" >> "$GITHUB_ENV"
39+ - name : Execute the README quick start
40+ run : uv run python scripts/run_readme_quickstart.py
41+ - name : Check every README link
42+ run : uv run python scripts/check_readme_links.py README.md
43+ - name : Build and verify documentation
44+ run : |
45+ uv run mkdocs build --strict
46+ uv run python scripts/verify_documentation_identity.py \
47+ --site site \
48+ --expected-library specs \
49+ --expected-version "$ML4T_DOCS_VERSION" \
50+ --expected-commit "$ML4T_DOCS_COMMIT"
51+ - uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
4252 with :
43- source-directory : site/
44- destination-github-username : ml4t
45- destination-repository-name : website
46- target-directory : static/docs/specs/
47- target-branch : main
48- commit-message : " docs(specs): update from ml4t/specs@${{ github.sha }}"
49- user-name : ml4t-bot
50- 53+ name : docs-${{ github.sha }}
54+ path : site/
55+ if-no-files-found : error
56+ retention-days : 14
0 commit comments