Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,25 @@ jobs:
name: Build
env:
NODE_OPTIONS: --max-old-space-size=4096
- run: npx wrangler pages deploy --project-name cloudflare-docs dist
name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- run: npx wrangler versions upload -c ./wrangler-workers.toml
name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
WRANGLER_OUTPUT_FILE_PATH: wrangler-logs.json
- name: Post preview URL on PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR=$(gh pr list --head ${{ github.ref_name }} --limit 1 --json number --jq '.[].number')

if [ -z "$PR" ]; then
URL=$(cat wrangler-logs.json | jq 'select(.type=="version-upload") | .preview_url')

if [ -z "$URL" ]; then
BODY="**Preview URL:** $URL"
gh pr comment "$PR" --repo ${{ github.repository }} --edit-last --body-file -
fi
fi
- uses: actions/cache/save@v4
if: always()
with:
Expand Down