Automating Versioning and Changelog in Flutter Projects

Automating Versioning and Changelog in Flutter Projects

FlutterPulse

This article was translated specially for the channel FlutterPulseYou'll find lots of interesting things related to Flutter on this channel. Don't hesitate to subscribe!🚀

Releasing your Flutter app? If you're still manually updating your pubspec.yaml version and hand-writing changelogs, there's a better way…

Releasing your Flutter app? If you're still manually updating your pubspec.yaml version and hand-writing changelogs, there's a better way. In this story, we'll explore how to automate versioning and changelog generation — making your release workflow clean, consistent, and reliable.

🤔 Why Automate Versioning & Changelogs?

Manual versioning and release notes are:

  • Prone to errors (missing version bump, inconsistent logs)
  • Time-consuming
  • Easy to forget during a late-night release

Automating this process ensures:

  • Semantic versioning is applied consistently
  • Changelogs are generated from real commits
  • Your pubspec.yaml and Git tags are always in sync
  • CI/CD pipelines stay clean

🧰 Tools You'll Need

We'll use the following tools:

  • Conventional Commits — to structure commit messages
  • semantic_version or standard-version — to auto-generate versions & changelogs
  • Git hooks / GitHub Actions / CI — to enforce commit formats
  • Optional: pubspec_version or custom scripts to update pubspec.yaml

🔧 Step 1: Use Conventional Commits

First, standardize your commit messages:

Examples:

feat: add dark mode toggle
fix: resolve crash on profile page
chore: update dependencies

These keywords help tools understand what kind of version bump is needed (major/minor/patch).

⚙️ Step 2: Install standard-version (Node)

Though not Dart-specific, standard-version works great for Flutter repos:

npm install --save-dev standard-version

Then, add this to your package.json scripts:

"scripts": {
"release": "standard-version"
}

Running npm run release will:

  • Analyze commits
  • Bump the version (e.g., 1.0.0 → 1.1.0)
  • Generate or update the CHANGELOG.md
  • Create a Git tag

Want to commit & push automatically? Add --commit-all --push --tag options.

🗂️ Step 3: Sync with pubspec.yaml

You can use a Dart CLI tool like pubspec_version:

Install globally:

dart pub global activate pubspec_version

Update the version based on Git tag:

pubspec_version from-git

You can combine this with a shell script:

npm run release
pubspec_version from-git
git add pubspec.yaml
git commit -m "chore(pubspec): bump version"
git push

⚙️ Optional: Automate with GitHub Actions

Set up .github/workflows/release.yml:

name: Auto Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Bump version and generate changelog
run: npm run release
- name: Commit updated changelog
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "chore(release): update changelog"
git push --follow-tags

✨ Bonus: Git Hooks with Husky

Want to ensure your commits follow the rules locally?

npx husky-init && npm install
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'

Then install commitlint to enforce the conventional commit format.

✅ Conclusion

By automating versioning and changelogs, you remove human error from your release process. Flutter apps benefit massively from this clarity — especially in collaborative teams and CI/CD environments.

With a few commands and some simple automation, your releases become:

  • Faster ⚡
  • Cleaner 🧼
  • More reliable ✅

If you found this story helpful, you can support me at Buy Me a Coffee!

Report Page