Release Process (RELEASE)¶
This document describes the development, verification, and release process for the three
flutter_zerorepositories (flutter_zero_app/flutter_zero_cli/flutter_zero_template).Core principle: the template and CLI are released decoupled. The template can release independently and frequently; the CLI usually does not need to follow. The two are connected through the version list in
template_registry.json(createpicks the largestversion,newmatches the exactversion).
0. Prerequisites¶
| Topic | Document |
|---|---|
| Three-repository responsibilities & architecture | Architecture Overview |
| Template version rules (SemVer bump) | Template Versioning |
| CLI version rules & compatibility logic | CLI Versioning |
| Template distribution mechanism (registry) | flutter_zero_template/template_registry.json |
Version rules in one line:
- PATCH (0.0.x) = bug fix / minor content fix, no contract change → CLI does nothing
- MINOR (0.x.0) = backward-compatible addition (optional variable with default, optional brick) → CLI does nothing
- MAJOR (x.0.0) = breaking change (change brick variable contract / generated code structure / DI anchor) → must add a version-specific adapter
1. Overall Flow¶
Phase A: Template development & verification (app → template → local verification)
Phase B: CLI adjustments (as needed)
Phase C: Release (decoupled) — the template can almost always move without the CLI
⚠️ Key correction: releasing the template ≠ the CLI must release. When the template is PATCH/MINOR, the CLI does not need to release at all, because
template_registry.jsonwill automatically point to the new template, and old CLI runs will automatically pull the latest compatible version.
Phase A: Template Development & Verification¶
A1. Verify architecture & template in flutter_zero_app¶
Implement / verify business, architecture, and template structure. flutter_zero_app is the template's verification project and the input source for the sync script.
A2. Sync template to flutter_zero_template¶
Use the sync script to sync the app into bricks/:
flutter_zero_app → {{name}}) + renames + overwrites files (see the variable config inside the script).
A3. Verify brick generation locally with mason¶
Make sure both bricks render correctly (requires global mason install: dart pub global activate mason_cli):
# enter the template directory
cd flutter_zero_template
# (optional) initialize the directory
mason init
# add the brick to local mason run
mason add feature --path brick/feature
# verify the feature template generation
mason make feature --name demo --package_name demo
A4. End-to-end verification with CLI local mode¶
Load the template locally via env var so it touches no network:
cd flutter_zero_cli
FLUZER_BRICKS_DIR=../flutter_zero_template/bricks dart run bin/fluzer.dart new demo
FLUZER_BRICKS_DIR=../flutter_zero_template/bricks dart run bin/fluzer.dart create demo_app
Phase B: CLI Adjustments (as needed)¶
B1. Modify flutter_zero_cli¶
When the template's variable contract or codemod anchor (class name / method name / DI injection region) changes, adjust the CLI code.
B2. Verify¶
Must be 0 issues + all green before release.Phase C: Release (decoupled)¶
C1. Release the template (core step, usually independent of the CLI)¶
- Decide the bump: per Template Versioning decide PATCH / MINOR / MAJOR.
- Package:
- Publish a GitHub Release (fixed version URL, not a
/latestredirect link): - Update
template_registry.json(version list, onlyversion+urlneeded): - PATCH / MINOR → update the matching
versionentry'surl(point to the new Release) - MAJOR → add a new entry (new
version+url), keep the old entry - Push to main (ensure the raw URL stays stably reachable):
✅ At this point, old CLI users will automatically pull the new template on their next run, with no CLI changes needed.
C2. Decide whether the CLI needs to release¶
| Scenario | Does the CLI release? |
|---|---|
| Template PATCH / MINOR | No (registry already points to the new template) |
| Template MAJOR (behavioral difference needs a new adapter) | Release if the CLI side needs a new version adapter; otherwise just updating the registry is enough |
| CLI itself has changes / bug fixes / new features | Release |
C3. Release the CLI (only when C2 decides it's needed)¶
- Update the
cliVersionconstant inlib/src/config/template_config.dart(must stay in sync withpubspec.yaml). - If the template is MAJOR, confirm the version adapters of the relevant commands (
new/gen-l10n) cover that template version. - Re-run
dart analyze+dart test. - Publish:
C4. Post-release verification¶
- Version prompt:
fluzer versionshould show the new-version prompt (after the CLI is published to pub.dev). - Real pull: via the real registry (the Release link
template_registry.jsonpoints to), verifyfluzer newend-to-end pulls the new template and generates correctly.
2. Pre-release Checklist¶
Before releasing the template
- [ ] Decide the bump type per Template Versioning
- [ ]
bricks.zippackaged, top level isbricks/ - [ ] GitHub Release uses a fixed version URL (not
/latest) - [ ]
template_registry.jsonupdated (PATCH/MINOR changes the matching entry'surl, MAJOR adds an entry) - [ ]
template_registry.jsonpushed to main
Before releasing the CLI
- [ ]
cliVersionconstant matches thepubspec.yamlversion - [ ]
dart analyze0 issues - [ ]
dart testall green - [ ] Placeholder URLs replaced with real addresses (see appendix 3.1)
- [ ]
CHANGELOG.mdandCHANGELOG_CN.mdboth have the new entry at the top, with matching content - [ ]
dart pub publish --dry-runpasses (no missing-dependency or similar errors) - [ ] If i18n strings changed,
dart run slanghas been run to regeneratestrings*.g.dart - [ ]
intlis explicitly declared inpubspec.yamldependencies(slang's pure-Dart output still doesimport 'package:intl/intl.dart') - [ ]
dart pub publishsucceeds
3. Appendix¶
3.1 Placeholders to replace (required before release)¶
Location: flutter_zero_cli/lib/src/config/template_config.dart
templateRegistryUrl→ real raw URLhttps://raw.githubusercontent.com/OWNER/REPO/main/template_registry.jsondefaultTemplateZipUrl→ real Release fixed-version URL (fallback when pull fails)cliVersion→ in sync withpubspec.yaml(must change on every CLI release)
⚠️ Never modify
minimumSupportedVersion: this constant is the "oldest template version the CLI accepts", unrelated to the CLI's own version (cliVersion). Bumping it to the CLI version would wrongly reject valid older templates such as1.0.xand break the lower-bound check. It must stay at1.0.0.
3.2 Command Quick Reference¶
| Purpose | Command |
|---|---|
| Sync template | cd flutter_zero_template && dart run scripts/sync_project_brick.dart |
| Verify brick locally | mason make feature --name demo --package_name demo |
| CLI load template locally | FLUZER_BRICKS_DIR=../flutter_zero_template/bricks dart run bin/fluzer.dart new demo |
| CLI check version update | fluzer version (use the global command after release) |
| Release template | zip -r bricks.zip bricks + gh release create vX.Y.Z bricks.zip + update registry + push |
| Release CLI | dart pub publish |
Doc maintenance: this process evolves with release practice. If you find a step that doesn't match reality, prioritize updating this document and the two
versioning-xxx.mdfiles.
Source of this page: docs/en/release.md