BM: Baca dalam Bahasa Melayu
World C3: Release & Deploy
Smoke tests and auto rollback
You will learn: how to taste a deploy right away, and let the pipeline undo a bad one by itself.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
The deploy goes green. The live site shows an error page. Which station will stop this line? Tap one, then run.
Which station will stop the line? Tap it, then press Run.
Workflow file .github/workflows/deploy.yml
name: Deploy on: push: branches: [main] permissions: contents: read jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: npm run deploy env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - run: curl --silent https://shop.example.com/health
The line
Push to main · main
Hint
Look closely at the curl line. What happens when it gets an error page?Watch
A smoke test: A quick taste right after a deploy: does the page load, does /health say ok? is one quick taste right after a deploy. Not the whole menu, one spoon. Good smoke tests, or not?
Swipe right for good, left for needs work. Or use the buttons.
Ask /health and expect 200 OK.
Try it
Fix the check from the first card. Build a curl that fails on an error page.
Tap the pieces in the right order.
Hint
curl, then –fail, then –silent, then the address.Watch
Add a rollback: Go back to the last good version, like serving yesterday's good batch again. job: it runs only if: failure(). Here the canary’s smoke test meets an error. Which station stops the line? Tap, then run.
Which station will stop the line? Tap it, then press Run.
Workflow file .github/workflows/release.yml
name: Release on: push: tags: ['v*'] workflow_dispatch: permissions: contents: read jobs: canary: runs-on: ubuntu-latest environment: canary steps: - uses: actions/checkout@v7 - run: npm ci - run: npm run deploy -- --env canary env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - run: curl --fail --silent https://canary.example.com/health production: needs: canary runs-on: ubuntu-latest environment: name: production url: https://shop.example.com steps: - uses: actions/checkout@v7 - run: npm ci - run: npm run deploy env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} rollback: needs: canary if: failure() runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: npm run rollback env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
The line
Push tag v1.3.1 · v1.3.1
Hint
The smoke test lives in the canary job.Try it
Build it yourself: deploy, taste, and roll back on failure.
Tap blocks to add them. Put them in order.
Blocks
Your workflow
Tap a block above to start.
Workflow file .github/workflows/
name: Deploy
What runs
Nothing to run yet.
Hint
The deploy job with its three steps. Then the rollback job that runs only on failure.Predict
Next week, the smoke test passes. What does the rollback job do?
Pick one answer.
You did it!
You can now catch a bad deploy and undo it automatically.
Go deeper (optional)
wrangler rollback swaps the code, not the data. Databases and other bindings stay as they are. Pair it with expand and contract. Want to taste before any user does? Deploy a version at 0%, then call it with the Cloudflare-Workers-Version-Overrides header.
Real rep (optional): give a test Worker a /health page and a curl check.
Bahasa Melayu
Deploy jadi hijau. Laman live tunjuk halaman ralat. Stesen mana akan hentikan talian ini? Tekan satu, kemudian Run.
Smoke test (rasa sekejap) ialah satu rasa pantas sejurus selepas deploy. Bukan seluruh menu, satu sudu. Smoke test yang bagus, atau tidak?
Baiki semakan dari kad pertama. Bina arahan curl yang gagal bila dapat halaman ralat.
Tambah job rollback: ia jalan hanya if: failure(). Di sini smoke test canary jumpa ralat. Stesen mana hentikan talian? Tekan, kemudian Run.
Bina sendiri: deploy, rasa, dan rollback bila gagal.
Minggu depan, smoke test lulus. Apa job rollback buat?
Kini anda boleh tangkap deploy yang teruk dan undurkannya secara automatik.
You finished this before. Practice is always welcome!
Official docs: curl: --fail · Status check functions: failure() · Cloudflare: rollbacks · Cloudflare: version overrides
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?