Skip to content

Commit 3e9c804

Browse files
frascuchonnataliaElvdavidberenstein1957
authored
[ENHANCEMENT] CI: Allow to publish hidden version for docs/ branches (#5088)
Co-authored-by: nataliaElv <[email protected]> Co-authored-by: davidberenstein1957 <[email protected]>
1 parent e9390de commit 3e9c804

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

.github/workflows/argilla.docs.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
branches:
1414
- "main"
1515
- "develop"
16+
- "docs/**"
1617

1718
defaults:
1819
run:
@@ -54,13 +55,46 @@ jobs:
5455
run: echo "${{ github.ref }}"
5556
echo "${{ github.head_ref }}"
5657

57-
- run: |
58+
- name: Deploy Argilla docs (branch /main)
59+
run: |
5860
pdm run mike deploy latest --push
5961
pdm run mike set-default --push latest
6062
if: github.ref == 'refs/heads/main'
6163

62-
- run: pdm run mike deploy dev --push
64+
- name: Deploy Argilla docs (branch /develop)
65+
run: pdm run mike deploy dev --push
6366
if: github.ref == 'refs/heads/develop'
6467

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 }}
6670
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

Comments
 (0)