Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
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
21 changes: 16 additions & 5 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write
name: Publish Preview
steps:
- uses: actions/checkout@v4
Expand All @@ -31,15 +32,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 [ -n "$PR" ]; then
URL=$(cat wrangler-logs.json | jq -r 'select(.type=="version-upload") | .preview_url')

if [ -n "$URL" ]; then
BODY="**Preview URL:** $URL"
gh pr comment "$PR" --edit-last --body "$BODY" || gh pr comment "$PR" --body "$BODY"
fi
fi
- uses: actions/cache/save@v4
if: always()
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/publish-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ 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 deploy -c ./wrangler-workers.toml
name: Deploy to Cloudflare Workers
env:
Expand Down
Loading