From fbbb84b91ae65a24f30f21dfc019ca752f7a41a3 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Fri, 27 Oct 2023 08:30:42 -0300 Subject: [PATCH] automate playground compiler (#6449) --- .github/workflows/ci.yml | 6 ++++++ playground/website_update_playground.sh | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 playground/website_update_playground.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee4915d233..f540f20557 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -371,3 +371,9 @@ jobs: run: | npm publish rescript-${{ needs.package.outputs.rescript_version }}.tgz --tag ci npm publish rescript-std-${{ needs.package.outputs.rescript_version }}.tgz --tag ci + + - name: Update Website Playground + env: + NEXT_REVALIDATE_SECRET_TOKEN: ${{ secrets.NEXT_REVALIDATE_SECRET_TOKEN }} + run: ./playground/website_update_playground.sh + shell: bash diff --git a/playground/website_update_playground.sh b/playground/website_update_playground.sh new file mode 100755 index 0000000000..aca64d06c4 --- /dev/null +++ b/playground/website_update_playground.sh @@ -0,0 +1,19 @@ +#/usr/bin/sh + +if [ -z "${NEXT_REVALIDATE_SECRET_TOKEN}" ]; then + echo "NEXT_REVALIDATE_SECRET_TOKEN environment variable not set." + exit 1 +fi + +echo "Sending request to rescript-lang.org/api/revalidate" + +STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://rescript-lang.org/api/revalidate?secret=${NEXT_REVALIDATE_SECRET_TOKEN}") + +if [[ "$STATUS_CODE" == 200 ]]; then + echo "Revalidation finished" + exit 0 +fi + +echo "Failed to revalidate" +echo "Status Code: $STATUS_CODE" +exit 1