Skip to content

feat: export expected-pattern engine, refresh docs, untrack artifacts #12

feat: export expected-pattern engine, refresh docs, untrack artifacts

feat: export expected-pattern engine, refresh docs, untrack artifacts #12

name: Cloudflare Workers - Deploy
permissions:
contents: read
on:
pull_request:
types: [closed]
paths:
- docs/**
- src/**
- static/**
- package.json
- pnpm-lock.yaml
- svelte.config.js
- vite.config.ts
- .github/workflows/cloudflare-deploy.yml
branches:
- main
workflow_dispatch:
# trunk-ignore(checkov/CKV_GHA_7)
inputs: {}
jobs:
deploy:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
runs-on: blacksmith-2vcpu-ubuntu-2404 # trunk-ignore(actionlint/runner-label)
environment: docs
name: Deploy
steps:
- name: Checkout
uses: actions/checkout@v7 # zizmor: ignore[unpinned-uses]
with:
persist-credentials: false
- uses: pnpm/action-setup@v6 # zizmor: ignore[unpinned-uses]
- name: Use Node.js - 24
uses: actions/setup-node@v7 # zizmor: ignore[unpinned-uses]
with:
node-version: 24
cache: pnpm
- name: Install Root Dependencies
run: pnpm install --frozen-lockfile
- name: Build Package
run: pnpm run build
- name: Deploy Docs
working-directory: docs
env:
NODE_OPTIONS: --max-old-space-size=4096
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# WRANGLER_LOG_SANITIZE: 'false'
# WRANGLER_LOG_LEVEL: debug
run: |
set -euxo pipefail
# Ensure log dir exists (wrangler writes here by default)
mkdir -p "${HOME}/.config/.wrangler/logs"
# Run deploy and capture exit code while letting us continue to upload logs
set +e
pnpm run deploy
DEPLOY_EXIT=$?
set -e
echo "Wrangler logs at: ${HOME}/.config/.wrangler/logs"
# Print last 200 lines of the latest wrangler log to job output
ls -lt "${HOME}/.config/.wrangler/logs" | head -n 5 || true
LATEST_LOG=$(ls -1t "${HOME}/.config/.wrangler/logs"/*.log 2>/dev/null | head -n 1 || true)
if [ -n "${LATEST_LOG}" ]; then
echo "::group::Wrangler log (tail)"
tail -n 200 "${LATEST_LOG}" || true
echo "::endgroup::"
fi
# Exit with original deploy status so the job fails if deploy failed
exit ${DEPLOY_EXIT}
- name: Upload Wrangler logs
if: always()
uses: actions/upload-artifact@v7 # zizmor: ignore[unpinned-uses]
with:
name: wrangler-logs
path: ~/.config/.wrangler/logs/*.log
retention-days: 7