Files
Oleg Isonen 2c51bc9928 fix: Restore Cloudflare publishing with Wrangler 4 (#6350)
Publishing fails because Wrangler 3 cannot parse the JSON import
attributes used by `html-tags@4`. Upgrade the CLI and Cloudflare
template to Wrangler 4.130.0 and regenerate the fixture and lockfile
used to package the publish artifact.

Wrangler 4 also rejects Worker deployment when it finds the Pages
configuration. Add a SaaS-only `wrangler.jsonc` that takes precedence
over the Pages template's TOML configuration. Publish commands still
supply the Worker name and compatibility date. Fix the staging smoke
check's compatibility-date scope and shell expansion.

- [x] Upgrade Wrangler and regenerate the publish fixture and lockfile.
- [x] Reproduce the original parser failure and verify it passes with
Wrangler 4.
- [x] Build the packaged artifact and pass the staging smoke check and
both SaaS publish dry runs, including dispatch-namespace arguments.
- [x] Pass 383 existing template tests, CLI and fixture typechecks,
repository lint, and all fixture generation from checked-in data.
- [x] Review documentation impact: no user-facing documentation changes
are required; the existing Node 22.12+ requirement remains sufficient.
- [ ] Complete staging CI and manually test publishing.

[Publish artifact
build](https://github.com/webstudio-is/webstudio/actions/runs/34400149252)
is running; [staging
deployment](https://github.com/webstudio-is/webstudio/actions/runs/34400149301)
is queued. Remix 2 still declares a Wrangler 3 peer dependency; the
packaged production build and both publish dry runs passed with v4.
Agent evaluations were not run.
2026-09-09 22:28:38 +02:00

141 lines
4.4 KiB
YAML

name: CLI R2
on:
push:
branches:
- "*.staging"
# cancel in-progress runs on new commits to same PR (gitub.event.number)
concurrency:
group: vercel-cli-r2-${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
statuses: write # This is required for the GitHub Script createCommitStatus to work
packages: write
deployments: write
env:
COMPATIBILITY_DATE: "2024-04-10"
jobs:
build:
environment:
name: "staging"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }} # HEAD commit instead of merge commit
# We need submodules here as this is used for the cloudflare build
- uses: ./.github/actions/submodules-checkout
with:
submodules-ssh-key: ${{ secrets.PRIVATE_GITHUB_DEPLOY_TOKEN }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
# TRY FIX cloudlare incident
- uses: unfor19/install-aws-cli-action@v1
with:
version: "2.22.35"
verbose: false
arch: amd64
- name: pnpm instal
run: pnpm install --ignore-scripts
- name: pnpm build
run: pnpm --filter 'webstudio-cloudflare-template^...' run build
# Ideally, execute 'pnpm deploy --prod', but @remix-run/dev doesn't support this flag.
# Despite being listed as a dependency, @remix-run/dev does not install the remix cli.
# TODO: Minimize artefact size due to frequent downloads on each publish.
- name: pnpm deploy
run: pnpm --filter 'webstudio-cloudflare-template' deploy "${{ github.workspace }}/../cloudflare-template"
- name: Verify optional Assets build dependency is omitted
run: test ! -e node_modules/@webstudio-is/content-engine/package.json
working-directory: ${{ github.workspace }}/../cloudflare-template
- name: Make archive
run: |
tar --use-compress-program="zstd -19" -cf cloudflare-template.tar.zst cloudflare-template
working-directory: ${{ github.workspace }}/..
- name: Copy artifact
run: |
# For staging
aws s3 cp cloudflare-template.tar.zst "s3://${ARTEFACT_BUCKET_NAME}/public/cloudflare-template/${{ github.ref_name }}.tar.zst"
# For production can be cached forever
aws s3 cp \
--metadata-directive REPLACE --cache-control "public,max-age=31536102,immutable" \
cloudflare-template.tar.zst "s3://${ARTEFACT_BUCKET_NAME}/public/cloudflare-template/${{ github.sha }}.tar.zst"
working-directory: ${{ github.workspace }}/..
env:
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ARTEFACT_BUCKET_NAME: ${{ secrets.ARTEFACT_BUCKET_NAME }}
checks:
environment:
name: "staging"
runs-on: ubuntu-latest
needs: build
steps:
- uses: pnpm/action-setup@v4
with:
version: "9"
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Copy atrifact via http
run: curl -o cloudflare-template.tar.zst ${{ secrets.ARTEFACT_BUCKET_URL }}/public/cloudflare-template/${{ github.ref_name }}.tar.zst
- name: Extract archive
run: tar --use-compress-program="zstd -d" -xf cloudflare-template.tar.zst -C .
- name: Webstudio Build
run: pnpm webstudio build --template internal --template saas-helpers --template cloudflare --assets false
working-directory: ${{ github.workspace }}/cloudflare-template
- name: Remix Build
run: pnpm build
working-directory: ${{ github.workspace }}/cloudflare-template
- name: WRANGLER Build
run: |
NODE_ENV=production pnpm wrangler deploy \
--name build \
--compatibility-date "${COMPATIBILITY_DATE}" \
--minify true \
--logpush true \
--dry-run \
--outdir dist \
'./functions/[[path]].ts'
working-directory: ${{ github.workspace }}/cloudflare-template
delete-github-deployments:
needs: checks
uses: ./.github/workflows/delete-github-deployments.yml
with:
ref: ${{ github.ref_name }}