BM: Baca dalam Bahasa Melayu
World C3: Release & Deploy
Capstone mission 3: Release it
You will learn: to give Kedai Kancil staging, production, a canary step and a rollback job, then prove it with a bad release.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
Pick an event. Press Run and watch the line.
Tag v1.0.1: the canary fails its smoke test, production is skipped, and rollback runs.
Workflow file .github/workflows/release.yml
name: Release on: push: tags: ['v*'] permissions: contents: read jobs: canary: runs-on: ubuntu-latest environment: staging steps: - uses: actions/checkout@v7 - run: npm ci - run: npx wrangler deploy --env staging env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - run: curl --fail --silent "$STAGING_URL/health" env: STAGING_URL: ${{ vars.STAGING_URL }} production: needs: canary runs-on: ubuntu-latest environment: name: production url: ${{ vars.SITE_URL }} steps: - uses: actions/checkout@v7 - run: npm ci - run: npx wrangler deploy --env production env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} rollback: needs: canary if: failure() runs-on: ubuntu-latest environment: staging steps: - uses: actions/checkout@v7 - run: npm ci - run: npx wrangler rollback --env staging --message "Canary failed" env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
The line
Push tag v1.0.1 · v1.0.1
Mission 3: Release it. Kedai Kancil already tests and builds itself. Now make releasing safe. Your goal: a bad release, caught and rolled back by the pipeline. Run it to see the goal.
Try it
Step 1: two kitchens. Your shop’s web front end goes on Cloudflare’s free Workers plan. Add this to wrangler.jsonc:
"account_id": "YOUR_ACCOUNT_ID",
"env": { "staging": {}, "production": {} }Real mission
gh api --method PUT "repos/{owner}/{repo}/environments/staging"gh api --method PUT "repos/{owner}/{repo}/environments/production"gh secret set CLOUDFLARE_API_TOKEN --env staginggh secret set CLOUDFLARE_API_TOKEN --env productiongh variable set STAGING_URL --body "https://kedai-kancil-staging.YOUR-SUBDOMAIN.workers.dev"
0 of 7 steps done · Your ticks are saved.
Try it
Step 2: build release.yml. Canary first. Production after it, with your approval. Rollback only if the canary fails.
Tap blocks to add them. Put them in order.
Blocks
Your workflow
Tap a block above to start.
Workflow file .github/workflows/
name: Release
What runs
Nothing to run yet.
Hint
Three jobs, each with its steps: canary, then production, then rollback.Try it
Step 3: ship one good release, then one bad one on purpose.
Real mission
git add .github/workflows/release.yml && git commit -m "ci: add release workflow" && git pushgit tag v1.0.0 && git push origin v1.0.0git tag v1.0.1 && git push origin v1.0.1
0 of 7 steps done · Your ticks are saved.
Check
Let GitHub’s public API confirm it. Type your username, then check.
Check it on GitHub
- Your Kedai Kancil repo is publicNot checked yet
- Workflows ran at least 3 timesNot checked yet
- It has at least 2 release tagsNot checked yet
Check
The API can’t see inside a run. Check these yourself.
Real mission
0 of 4 steps done · Your ticks are saved.
You did it!
You can now release Kedai Kancil safely, with an undo button.
Go deeper (optional)
Safety: the free Workers plan is enough here. Containers for the API need Workers Paid. Set a budget alert first. Use test tokens and delete them when done. This canary is a staging copy. A true canary sends a share of real users. On Cloudflare, that is a gradual deployment.
Bahasa Melayu
Misi 3: Lancarkan. Kedai Kancil dah uji dan build dirinya sendiri. Sekarang jadikan release selamat. Matlamat anda: release teruk yang ditangkap dan diundur oleh pipeline. Run untuk lihat matlamatnya.
Langkah 1: dua dapur. Bahagian depan web kedai anda masuk ke pelan Workers percuma Cloudflare. Tambah ini dalam wrangler.jsonc:
"account_id": "YOUR_ACCOUNT_ID",
"env": { "staging": {}, "production": {} }
Langkah 2: bina release.yml. Canary dulu. Production selepasnya, dengan kelulusan anda. Rollback hanya kalau canary gagal.
Langkah 3: hantar satu release yang elok, kemudian satu yang teruk dengan sengaja.
Biar API awam GitHub sahkan. Taip nama pengguna anda, kemudian semak.
API tak boleh tengok dalam larian. Semak yang ini sendiri.
Kini anda boleh lancarkan Kedai Kancil dengan selamat, dengan butang undur.
You finished this before. Practice is always welcome!
Official docs: Cloudflare: Wrangler environments · Cloudflare: GitHub Actions · Deployments and environments · gh secret set
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?