|
13 | 13 | branches: |
14 | 14 | - "main" |
15 | 15 | - "develop" |
| 16 | + - "docs/**" |
16 | 17 |
|
17 | 18 | defaults: |
18 | 19 | run: |
@@ -54,13 +55,46 @@ jobs: |
54 | 55 | run: echo "${{ github.ref }}" |
55 | 56 | echo "${{ github.head_ref }}" |
56 | 57 |
|
57 | | - - run: | |
| 58 | + - name: Deploy Argilla docs (branch /main) |
| 59 | + run: | |
58 | 60 | pdm run mike deploy latest --push |
59 | 61 | pdm run mike set-default --push latest |
60 | 62 | if: github.ref == 'refs/heads/main' |
61 | 63 |
|
62 | | - - run: pdm run mike deploy dev --push |
| 64 | + - name: Deploy Argilla docs (branch /develop) |
| 65 | + run: pdm run mike deploy dev --push |
63 | 66 | if: github.ref == 'refs/heads/develop' |
64 | 67 |
|
65 | | - - run: pdm run mike deploy ${{ github.ref_name }} |
| 68 | + - name: Deploy Argilla docs (release vX.Y.Z) |
| 69 | + run: pdm run mike deploy ${{ github.ref_name }} |
66 | 70 | if: startsWith(github.ref, 'refs/tags/') |
| 71 | + |
| 72 | + - name: Delete Argilla docs (versions 'docs_*') |
| 73 | + id: delete_deployment |
| 74 | + run: | |
| 75 | + versions=$(pdm run mike list) |
| 76 | + formatted_versions=$(echo "$versions" | tr ',' '\n' | tr -d '[]') |
| 77 | + for version in $versions; do |
| 78 | + if [[ $version == docs_* ]]; then |
| 79 | + echo "Deleting version: $version" |
| 80 | + pdm run mike delete "$version" --push |
| 81 | + fi |
| 82 | + done |
| 83 | + if: startsWith(github.ref, 'refs/tags/') |
| 84 | + |
| 85 | + - name: Extract branch name |
| 86 | + id: extract_branch_name |
| 87 | + shell: bash |
| 88 | + run: echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's/\//_/g' >> $GITHUB_OUTPUT |
| 89 | + |
| 90 | + - name: Deploy Argilla docs (branch /docs/*) |
| 91 | + run: pdm run mike deploy ${{ steps.extract_branch_name.outputs.branch_name }} --prop-set hidden=true --push |
| 92 | + if: startsWith(github.ref, 'refs/heads/docs') || startsWith(github.head_ref, 'docs/') |
| 93 | + |
| 94 | + - name: Add deployment message in PR |
| 95 | + uses: mshick/add-pr-comment@v2 |
| 96 | + if: startsWith(github.ref, 'refs/heads/docs') || startsWith(github.head_ref, 'docs/') |
| 97 | + with: |
| 98 | + message: | |
| 99 | + Docs for this PR have been deployed hidden from versioning: [https://argilla-io.github.io/argilla/${{ steps.extract_branch_name.outputs.branch_name }}](https://argilla-io.github.io/argilla/${{ steps.extract_branch_name.outputs.branch_name }}) |
| 100 | +
|
0 commit comments