|
66 | 66 | done |
67 | 67 |
|
68 | 68 | - name: Deploy to GitHub Pages |
| 69 | + id: deploy |
69 | 70 | uses: peaceiris/actions-gh-pages@v3 |
70 | 71 | with: |
71 | 72 | github_token: ${{ secrets.GITHUB_TOKEN }} |
|
81 | 82 | echo "url=${PREVIEW_URL}" >> $GITHUB_OUTPUT |
82 | 83 | echo "Preview URL: ${PREVIEW_URL}" |
83 | 84 |
|
| 85 | + - name: Verify deployment and wait for availability |
| 86 | + run: | |
| 87 | + PREVIEW_URL="${{ steps.preview-url.outputs.url }}" |
| 88 | + MAX_ATTEMPTS=12 |
| 89 | + ATTEMPT=0 |
| 90 | +
|
| 91 | + echo "Verifying GitHub Pages deployment..." |
| 92 | + echo "Preview URL: ${PREVIEW_URL}" |
| 93 | +
|
| 94 | + # Wait up to 2 minutes for the preview to become available |
| 95 | + while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do |
| 96 | + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "${PREVIEW_URL}" || echo "000") |
| 97 | + if [ "$HTTP_CODE" = "200" ]; then |
| 98 | + echo "✓ Preview is now available and accessible!" |
| 99 | + exit 0 |
| 100 | + fi |
| 101 | + ATTEMPT=$((ATTEMPT + 1)) |
| 102 | + if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then |
| 103 | + echo "Attempt ${ATTEMPT}/${MAX_ATTEMPTS}: Preview not yet available (HTTP ${HTTP_CODE}), waiting 10 seconds..." |
| 104 | + sleep 10 |
| 105 | + fi |
| 106 | + done |
| 107 | +
|
| 108 | + echo "⚠ Preview deployment completed, but URL not yet accessible (may still be propagating)." |
| 109 | + echo "The preview should be available shortly. Comment will be added with the preview URL." |
| 110 | +
|
84 | 111 | - name: Find existing comment |
| 112 | + if: success() |
85 | 113 | uses: peter-evans/find-comment@v3 |
86 | 114 | id: find-comment |
87 | 115 | with: |
|
90 | 118 | body-includes: 'Preview Build' |
91 | 119 |
|
92 | 120 | - name: Create or update PR comment |
| 121 | + if: success() |
93 | 122 | uses: peter-evans/create-or-update-comment@v4 |
94 | 123 | with: |
95 | 124 | comment-id: ${{ steps.find-comment.outputs.comment-id }} |
|
0 commit comments