Skip to content

Plugin: updater-pubspec

Updates the top-level version: field in pubspec.yaml for Dart and Flutter projects, with configurable Flutter +build suffix strategies (none, increment, or release-count).

Terminal window
semrel plugin install @semrel/updater-pubspec

semrel plugin install downloads the binary to .semrel/plugins/ and updates .semrel.lock. Commit .semrel.lock to pin the version for your team.

Pre-built, signed multi-platform images (linux/amd64, linux/arm64) are published on every release:

Terminal window
docker pull ghcr.io/semrels/updater-pubspec:latest

Verify the image signature with cosign:

Terminal window
cosign verify ghcr.io/semrels/updater-pubspec:latest \
--certificate-identity-regexp 'https://github.com/SemRels/updater-pubspec/.github/workflows/release.yml.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
version: 1
plugins:
- uses: @semrel/updater-pubspec
phase: pre-tag
args:
pubspec_path: pubspec.yaml
pubspec_build_strategy: increment
NameRequiredDefaultDescription
SEMREL_PLUGIN_PUBSPEC_PATHno./pubspec.yamlPath to the pubspec.yaml file to update.
SEMREL_PLUGIN_PUBSPEC_BUILD_STRATEGYnononeBuild suffix strategy: none, increment, or release-count.
SEMREL_PLUGIN_PUBSPEC_BUILD_NUMBERno—Explicit build number override (<semver>+<number>).
  • SEMREL_VERSION
  • SEMREL_NEXT_VERSION
  • SEMREL_DRY_RUN
  • SEMREL_RELEASE_COUNT
  • SEMREL_BUILD_NUMBER

The plugin performs a surgical line-based update of the top-level version: key so comments, indentation, and dependency blocks remain untouched:

  • none (default): Writes bare SemVer (e.g. version: 1.5.0).
  • increment: Increments the existing +build suffix (e.g. 1.4.0+42 → 1.5.0+43), starting at +1 if none exists.
  • release-count: Uses SEMREL_PLUGIN_PUBSPEC_BUILD_NUMBER, SEMREL_RELEASE_COUNT, or SEMREL_BUILD_NUMBER (falling back to existing + 1).