|
1 | 1 | name: Documentation |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | tags: |
5 | 6 | - v* |
| 7 | + # Allows to run the workflow manually |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + pages: write |
| 14 | + id-token: write |
| 15 | + |
| 16 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 17 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 18 | +concurrency: |
| 19 | + group: "pages" |
| 20 | + cancel-in-progress: false |
| 21 | + |
| 22 | +env: |
| 23 | + CUSTOM_DOMAIN: python-sdk.meilisearch.com |
6 | 24 |
|
7 | 25 | jobs: |
8 | | - docs: |
| 26 | + build: |
9 | 27 | runs-on: ubuntu-latest |
10 | 28 | steps: |
11 | 29 | - uses: actions/checkout@v3 |
12 | 30 | with: |
13 | 31 | fetch-depth: 0 |
14 | 32 | lfs: true |
| 33 | + - name: Setup Github Pages |
| 34 | + uses: actions/configure-pages@v3 |
15 | 35 | - name: Install Python |
16 | 36 | uses: actions/setup-python@v4 |
17 | 37 | with: |
18 | | - python-version: '3.10' |
| 38 | + python-version: "3.10" |
19 | 39 | - name: Install pipenv |
20 | 40 | run: | |
21 | 41 | pip install pipx |
|
29 | 49 | run: | |
30 | 50 | pipenv run sphinx-apidoc -f -o docs meilisearch/ |
31 | 51 | pipenv run sphinx-build docs ./docs/_build/html/ |
32 | | - - name: Deploy |
33 | | - uses: peaceiris/actions-gh-pages@v3 |
| 52 | + # CNAME file is required for GitHub pages custom domain |
| 53 | + - name: Create CNAME file |
| 54 | + run: | |
| 55 | + echo "$CUSTOM_DOMAIN" > ./docs/_build/html/CNAME |
| 56 | + echo "Created CNAME in ./docs/_build/html/: $CUSTOM_DOMAIN" |
| 57 | + - name: Upload artifacts |
| 58 | + uses: actions/upload-pages-artifact@v2 |
34 | 59 | with: |
35 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
36 | | - publish_dir: docs/_build/html |
37 | | - force_orphan: true |
| 60 | + path: "./docs/_build/html" |
| 61 | + deploy: |
| 62 | + needs: build |
| 63 | + environment: |
| 64 | + name: github-pages |
| 65 | + url: ${{ steps.deployment.outputs.page_url }} |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Deploy to GitHub Pages |
| 69 | + id: deployment |
| 70 | + uses: actions/deploy-pages@v2 |
0 commit comments