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