|
28 | 28 | - name: Run the Tests |
29 | 29 | run: | |
30 | 30 | tox -e tests |
31 | | - generate: |
| 31 | + json_schemas: |
32 | 32 | name: Generate JSON-Schemas |
33 | 33 | runs-on: ubuntu-latest |
34 | 34 | needs: tests |
|
70 | 70 | env: |
71 | 71 | GITHUB_TOKEN: ${{ secrets.BO4E_PYTHON_GENERATE_SCHEMAS }} # this token expires on 2024-10-09 |
72 | 72 | VERSION: ${{ github.ref_name }} |
| 73 | + docs: |
| 74 | + name: 🚀📄 Build and deploy documentation to GitHub Pages |
| 75 | + # This setup is inspired by |
| 76 | + # https://github.com/KernelTuner/kernel_tuner/blob/master/.github/workflows/docs-on-release.yml |
| 77 | + runs-on: ubuntu-latest |
| 78 | + needs: tests |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + with: |
| 82 | + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo |
| 83 | + - name: Set up Python |
| 84 | + uses: actions/setup-python@v5 |
| 85 | + with: |
| 86 | + python-version: ${{ matrix.python-version }} |
| 87 | + - name: Install dependencies |
| 88 | + run: | |
| 89 | + python -m pip install --upgrade pip |
| 90 | + pip install -r requirements.txt |
| 91 | + # Note: The sphinx action below can only install a single requirements file. |
| 92 | + - name: Write version to conf.py |
| 93 | + run: | |
| 94 | + echo -e "version = release = \"${{ github.ref_name }}\"\n" | cat - docs/conf.py > /tmp/conf.py |
| 95 | + mv /tmp/conf.py docs/conf.py |
| 96 | + - name: Build the documentation |
| 97 | + uses: sphinx-notes/pages@v2 |
| 98 | + # Note: This action has a newer version (v3 atm), but it doesn't has the feature to specify the target path. |
| 99 | + # We need that in order to be able to store (and deploy) multiple versions of the documentation. |
| 100 | + with: |
| 101 | + requirements_path: docs/requirements.txt |
| 102 | + documentation_path: docs/ |
| 103 | + target_path: ${{ github.ref_name }} |
| 104 | + target_branch: gh-pages |
| 105 | + sphinx_options: -W -j auto |
| 106 | + - id: latest_bo4e |
| 107 | + name: Get latest BO4E release tag |
| 108 | + uses: pozetroninc/github-action-get-latest-release@master |
| 109 | + with: |
| 110 | + repository: ${{ github.repository }} |
| 111 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + - name: Redirect stable to new release if the new release is marked as latest |
| 113 | + if: steps.latest_bo4e.outputs.release == github.ref_name |
| 114 | + run: | |
| 115 | + echo "Redirecting stable to new version ${{ github.ref_name }}" |
| 116 | + rm -rf stable |
| 117 | + ln -s ${{ github.ref_name }} stable |
| 118 | + git add stable |
| 119 | + git commit -m "Redirect stable to new version ${{ github.ref_name }}" |
| 120 | + - name: Push changes |
| 121 | + uses: ad-m/github-push-action@master |
| 122 | + with: |
| 123 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + branch: gh-pages |
73 | 125 | build-n-publish: |
74 | 126 | name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
75 | 127 | runs-on: ubuntu-latest |
|
78 | 130 | permissions: |
79 | 131 | # IMPORTANT: this permission is mandatory for trusted publishing |
80 | 132 | id-token: write |
81 | | - needs: [tests, generate] |
| 133 | + needs: [tests, json_schemas, docs] |
82 | 134 | steps: |
83 | 135 | - uses: actions/checkout@v4 |
84 | 136 | - name: Set up Python |
|
0 commit comments