diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e19b608664..66f8b4ed6d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,5 +29,30 @@ jobs: - name: Doc indexing webhook for tag id: trigger-index run: | - curl -X POST -H "Content-Type: application/json" -d "{\"tag\": \"${{steps.extract-version.outputs.version}}\", \"to_index\": [\"docs\"]}" ${{ secrets.DOC_INDEXING_WEBHOOK }} - curl -X POST -H "Content-Type: application/json" -d "{\"tag\": \"${{steps.extract-version.outputs.snapshot_version}}\", \"to_index\": [\"docs\"]}" ${{ secrets.DOC_INDEXING_WEBHOOK }} \ No newline at end of file + version=${{steps.extract-version.outputs.version}} + curl -X POST -H "Content-Type: application/json" -d "{\"tag\": \"$version\", \"to_index\": [\"docs\"]}" ${{ secrets.DOC_INDEXING_WEBHOOK }} + if [ -n "${{steps.extract-version.outputs.snapshot_version}}" ]; then + snapshot_version=${{steps.extract-version.outputs.snapshot_version}} + major_version=${version%%.*} + major_version=${major_version#v} + major_snapshot_version=${snapshot_version%%.*} + major_snapshot_version=${major_snapshot_version#v} + + : # Here we try to detect if there is a gap between stable and snapshot release, if that's the case we're probably under an RC release and that must be covered so we launch the indexing for the RC version + if [ $major_version -eq $major_snapshot_version ]; then + tmp=${version#*.} + minor_version=${tmp%%.*} + minor_version=${minor_version#v} + tmp=${snapshot_version#*.} + minor_snapshot_version=${tmp%%.*} + minor_snapshot_version=${minor_snapshot_version#v} + + rc_minor_version=$(($minor_version + 1)) + if [ $rc_minor_version -lt $minor_snapshot_version ]; then + curl -X POST -H "Content-Type: application/json" -d "{\"tag\": \"v${major_version}.${rc_minor_version}.0-SNAPSHOT\", \"to_index\": [\"docs\"]}" ${{ secrets.DOC_INDEXING_WEBHOOK }} + fi + fi + + : # Run indexing for SNAPSHOT version + curl -X POST -H "Content-Type: application/json" -d "{\"tag\": \"$snapshot_version\", \"to_index\": [\"docs\"]}" ${{ secrets.DOC_INDEXING_WEBHOOK }} + fi \ No newline at end of file