This repository was archived by the owner on Mar 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,14 @@ jobs:
4141 - name : Build docs
4242 run : tox -e docs
4343
44+ - name : Sanitize ref name for docs version
45+ run : echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV
46+
4447 - name : Move to versioned directory
45- # e.g. main or 0.1.2
46- run : mv build/html ".github/pages/${{ github.ref_name }}"
48+ run : mv build/html .github/pages/$DOCS_VERSION
4749
4850 - name : Write switcher.json
49- run : python .github/pages/make_switcher.py --add "${{ github.ref_name }}" ${{ github.repository }} .github/pages/switcher.json
51+ run : python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json
5052
5153 - name : Publish Docs to gh-pages
5254 if : github.event_name == 'push'
Original file line number Diff line number Diff line change @@ -24,17 +24,20 @@ jobs:
2424
2525 - name : removing documentation for branch ${{ github.event.ref }}
2626 if : ${{ github.event_name != 'workflow_dispatch' }}
27- run : echo "remove_me =${{ github.event.ref }}" >> $GITHUB_ENV
27+ run : echo "REF_NAME =${{ github.event.ref }}" >> $GITHUB_ENV
2828
2929 - name : manually removing documentation version ${{ github.event.inputs.version }}
3030 if : ${{ github.event_name == 'workflow_dispatch' }}
31- run : echo "remove_me=${{ github.event.inputs.version }}" >> $GITHUB_ENV
31+ run : echo "REF_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV
32+
33+ - name : Sanitize ref name for docs version
34+ run : echo "DOCS_VERSION=${REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV
3235
3336 - name : update index and push changes
3437 run : |
35- rm -r ${{ env.remove_me }}
36- python make_switcher.py --remove ${{ env.remove_me }} ${{ github.repository }} switcher.json
38+ rm -r ${{ env.DOCS_VERSION }}
39+ python make_switcher.py --remove $DOCS_VERSION ${{ github.repository }} switcher.json
3740 git config --global user.name 'GitHub Actions Docs Cleanup CI'
3841 git config --global user.email '[email protected] ' 39- git commit -am"removing redundant docs version ${{ env.remove_me }} "
42+ git commit -am "Removing redundant docs version $DOCS_VERSION "
4043 git push
Original file line number Diff line number Diff line change @@ -123,5 +123,7 @@ allowlist_externals = pre-commit
123123commands = pre-commit run --all-files {posargs}
124124
125125[testenv:docs]
126- allowlist_externals = sphinx-build sphinx-autobuild
126+ allowlist_externals =
127+ sphinx-build
128+ sphinx-autobuild
127129commands = sphinx-{posargs:build -EW --keep-going} -T docs build/html
You can’t perform that action at this time.
0 commit comments