|
2 | 2 | workflow_call: |
3 | 3 |
|
4 | 4 | jobs: |
5 | | - publish: |
| 5 | + build: |
6 | 6 | runs-on: ubuntu-latest |
7 | 7 |
|
8 | 8 | steps: |
| 9 | + - name: Avoid git conflicts when tag and branch pushed at same time |
| 10 | + if: github.ref_type == 'tag' |
| 11 | + run: sleep 60 |
| 12 | + |
9 | 13 | - name: Checkout |
10 | 14 | uses: actions/checkout@v4 |
11 | 15 | with: |
12 | 16 | # Need this to get version number from last tag |
13 | 17 | fetch-depth: 0 |
14 | 18 |
|
15 | | - - name: Download built docs artifact |
16 | | - uses: actions/download-artifact@v4 |
| 19 | + - name: Install system packages |
| 20 | + run: sudo apt-get install graphviz |
| 21 | + |
| 22 | + - name: Install python packages |
| 23 | + uses: ./.github/actions/install_requirements |
| 24 | + |
| 25 | + - name: Build docs |
| 26 | + run: tox -e docs |
| 27 | + |
| 28 | + - name: Remove environment.pickle |
| 29 | + run: rm build/html/.doctrees/environment.pickle |
| 30 | + |
| 31 | + - name: Upload built docs artifact |
| 32 | + uses: actions/upload-artifact@v4 |
17 | 33 | with: |
18 | 34 | name: docs |
19 | 35 | path: build |
20 | 36 |
|
21 | 37 | - name: Sanitize ref name for docs version |
22 | | - run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z-1-9._-]/_}" >> $GITHUB_ENV |
| 38 | + run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV |
23 | 39 |
|
24 | 40 | - name: Move to versioned directory |
25 | 41 | run: mv build/html .github/pages/$DOCS_VERSION |
|
28 | 44 | run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json |
29 | 45 |
|
30 | 46 | - name: Publish Docs to gh-pages |
| 47 | + if: github.ref_type == 'tag' || github.ref_name == 'main' |
31 | 48 | # We pin to the SHA, not the tag, for security reasons. |
32 | 49 | # https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions |
33 | 50 | uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 |
|
0 commit comments