diff --git a/.github/workflows/website-build.yml b/.github/workflows/website-build.yml index b000151..4a53651 100644 --- a/.github/workflows/website-build.yml +++ b/.github/workflows/website-build.yml @@ -1,14 +1,36 @@ +name: Trigger Website Build + on: release: types: - published - unpublished - deleted + +permissions: + contents: read + jobs: trigger-website-build: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - - name: Install HTTPie - run: sudo snap install --edge httpie - name: Trigger website build - run: http --ignore-stdin POST ${{ secrets.PIE_WEB_VERCEL_HOOK }} + env: + WEBHOOK_URL: ${{ secrets.PIE_WEB_VERCEL_HOOK }} + run: | + set -euo pipefail + if [[ -z "${WEBHOOK_URL:-}" ]]; then + echo "::error::PIE_WEB_VERCEL_HOOK secret is not set" + exit 1 + fi + for i in 1 2 3; do + if curl -fsS -X POST "${WEBHOOK_URL}"; then + echo "Webhook triggered successfully (attempt $i)" + exit 0 + fi + echo "Attempt $i failed, retrying..." + sleep 5 + done + echo "::error::Failed to trigger webhook after 3 attempts" + exit 1