From fab8da2e56837db75219f07afc5ea4379736df53 Mon Sep 17 00:00:00 2001 From: peterkogo Date: Thu, 12 Sep 2024 11:25:20 +0200 Subject: [PATCH] add release dispatcher for web repo --- .github/workflows/dispatchWebsiteUpdate.yaml | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/dispatchWebsiteUpdate.yaml diff --git a/.github/workflows/dispatchWebsiteUpdate.yaml b/.github/workflows/dispatchWebsiteUpdate.yaml new file mode 100644 index 00000000..6acc97ac --- /dev/null +++ b/.github/workflows/dispatchWebsiteUpdate.yaml @@ -0,0 +1,29 @@ +name: Dispatch Website Update +run-name: Dispatch Website Update for ${{ github.event.release.tag_name }} + +on: + release: + types: [published] + +jobs: + dispatch_website_update: + if: ${{ contains(github.event.release.tag_name, 'svelte') || contains(github.event.release.tag_name, 'react') }} + runs-on: ubuntu-latest + steps: + # Github Actions is not able to escape JSON strings with certain characters in them + # which release bodies have plenty of. This step uses jq to extract the body and tag_name + # and escape them so they can be used in the next step to create a JSON for the client-payload + - name: Strip and escape JSON + run: | + { + echo 'ESCAPED_PAYLOAD<> "$GITHUB_ENV" + - name: Dispatch Website Update + uses: peter-evans/repository-dispatch@v3 + with: + repository: xyflow/web + token: ${{ secrets.PAT }} + event-type: library-release + client-payload: ${{ env.ESCAPED_PAYLOAD }}