Skip to content

Bump wrangler from 4.88.0 to 4.104.0 in /worker #367

Bump wrangler from 4.88.0 to 4.104.0 in /worker

Bump wrangler from 4.88.0 to 4.104.0 in /worker #367

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
embed:
description: 'Also publish the embed to live'
type: boolean
default: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: |
package-lock.json
worker/package-lock.json
- name: Install frontend dependencies
run: npm ci
- name: Install worker dependencies
run: npm ci
working-directory: worker
- name: Check formatting
run: npm run fmt:check
- name: Lint frontend
run: npm run lint
- name: Run frontend tests
run: npm test
- name: Run worker tests
run: npm test
working-directory: worker
- name: Copy engine files
run: npm run build:engine
- name: Build frontend
run: npx vite build
- name: Build embed
run: |
node scripts/build-embed-pieces.js
npx vite build --config vite.config.embed.js
- name: Bundle size report
run: |
echo "### Bundle Sizes" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| File | Size | Gzip |" >> $GITHUB_STEP_SUMMARY
echo "|------|------|------|" >> $GITHUB_STEP_SUMMARY
JS=$(ls -la dist/assets/index-*.js | awk '{printf "%.1f KB", $5/1024}')
JS_GZ=$(gzip -c dist/assets/index-*.js | wc -c | awk '{printf "%.1f KB", $1/1024}')
CSS=$(ls -la dist/assets/index-*.css | awk '{printf "%.1f KB", $5/1024}')
CSS_GZ=$(gzip -c dist/assets/index-*.css | wc -c | awk '{printf "%.1f KB", $1/1024}')
EMBED=$(ls -la dist-embed/tnmp-viewer.js | awk '{printf "%.1f KB", $5/1024}')
EMBED_GZ=$(gzip -c dist-embed/tnmp-viewer.js | wc -c | awk '{printf "%.1f KB", $1/1024}')
echo "| JS | $JS | $JS_GZ |" >> $GITHUB_STEP_SUMMARY
echo "| CSS | $CSS | $CSS_GZ |" >> $GITHUB_STEP_SUMMARY
echo "| Embed | $EMBED | $EMBED_GZ |" >> $GITHUB_STEP_SUMMARY
- name: Upload embed artifact
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: actions/upload-artifact@v7
with:
name: embed-${{ github.sha }}
path: dist-embed/tnmp-viewer.js
retention-days: 30
deploy:
needs: test
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: |
package-lock.json
worker/package-lock.json
- name: Install frontend dependencies
run: npm ci
- name: Install worker dependencies
run: npm ci
working-directory: worker
- name: Apply D1 migrations
run: npx wrangler d1 migrations apply tnmp-games --remote
working-directory: worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy worker
run: npx wrangler deploy
working-directory: worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Build and deploy frontend
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
COMMIT_MSG: ${{ github.event.head_commit.message }}
EMBED_INPUT: ${{ inputs.embed }}
run: |
npm run build:engine
npx vite build
mkdir -p dist/embed
if echo "${COMMIT_MSG}${EMBED_INPUT}" | grep -qiE '\[embed\]|true'; then
echo "Building fresh embed for publish..."
node scripts/build-embed-pieces.js
npx vite build --config vite.config.embed.js
cp dist-embed/tnmp-viewer.js dist/embed/
else
curl -sSf https://tnmpairings.com/embed/tnmp-viewer.js -o dist/embed/tnmp-viewer.js || echo "No live embed found — skipping"
fi
npx wrangler pages deploy dist --project-name=tnmpairings
- name: Tag embed publish
if: contains(github.event.head_commit.message, '[embed]') || inputs.embed == true
run: |
EMBED_VERSION=$(date +%Y%m%d-%H%M%S)
git tag "embed-v${EMBED_VERSION}"
git push origin "embed-v${EMBED_VERSION}"