From 0f1582be021254237ad66a80261723c355aa6b13 Mon Sep 17 00:00:00 2001 From: "brian.mulier" Date: Wed, 16 Oct 2024 10:36:08 +0200 Subject: [PATCH] feat(ci): introduce branch / tags-driven indexing CI --- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..17aed8f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +name: Index blueprints + +on: + push: + branches: + - latest-stable + - develop + tags: + - v* + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + index-blueprints: + name: Index blueprints + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Extract version to index + run: | + REF=${GITHUB_REF#refs/} + echo $REF + if [[ $REF == 'heads/latest-stable' ]]; then + echo "version=v$(curl -s https://api.kestra.io/v1/versions/latest | jq -r '.version')" >> $GITHUB_OUTPUT + elif [[ $REF == 'heads/develop' ]]; then + echo "version=v$(curl -s https://api.kestra.io/v1/versions/latest?snapshot=true | jq -r '.version')" >> $GITHUB_OUTPUT + elif [[ $REF == 'tags/v'* ]]; then + echo "version=${REF#tags/}" >> $GITHUB_OUTPUT + fi + - name: Blueprints indexing webhook for tag + id: trigger-index + run: | + curl -X POST -H "Content-Type: application/json" -d "{\"tag\": \"${{steps.vars.outputs.version}}\", \"to_index\": [\"blueprints\"]}" https://us.kestra.cloud/api/v1/kestra-tech/executions/webhook/product/indexing/${{ secrets.DOC_INDEXING_WEBHOOK }} \ No newline at end of file