Skip to content

Commit 9ed4d31

Browse files
committed
Add pushing back into _docs.yml conditional on needs.test.result
1 parent 87f2f36 commit 9ed4d31

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/_docs.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,22 @@ jobs:
3333
with:
3434
name: docs
3535
path: build
36+
37+
- name: Sanitize ref name for docs version
38+
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV
39+
40+
- name: Move to versioned directory
41+
run: mv build/html .github/pages/$DOCS_VERSION
42+
43+
- name: Write switcher.json
44+
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json
45+
46+
- name: Publish Docs to gh-pages
47+
if: needs.test.result && (github.ref_type == 'tag' || github.ref_name == 'main')
48+
# We pin to the SHA, not the tag, for security reasons.
49+
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
50+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
publish_dir: .github/pages
54+
keep_files: true

0 commit comments

Comments
 (0)