World map

 

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.

What happened on GitHub

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

  1. gh api --method PUT "repos/{owner}/{repo}/environments/staging"
  2. gh api --method PUT "repos/{owner}/{repo}/environments/production"
  3. gh secret set CLOUDFLARE_API_TOKEN --env staging
  4. gh secret set CLOUDFLARE_API_TOKEN --env production
  5. gh 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.

Try it

Step 3: ship one good release, then one bad one on purpose.

Real mission

  1. git add .github/workflows/release.yml && git commit -m "ci: add release workflow" && git push
  2. git tag v1.0.0 && git push origin v1.0.0
  3. git 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 username is sent only to api.github.com.

  • 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.