Skip to content

ci: publish to pub.dev automatically on version tags - #39

Open
theashraf wants to merge 1 commit into
mainfrom
ci/pub-dev-automated-publishing
Open

ci: publish to pub.dev automatically on version tags#39
theashraf wants to merge 1 commit into
mainfrom
ci/pub-dev-automated-publishing

Conversation

@theashraf

@theashraf theashraf commented Aug 12, 2026

Copy link
Copy Markdown
Member

Publishing currently requires someone to hold pub.dev credentials locally and run flutter pub publish by hand. This replaces that with a tag-triggered workflow.

Push a vX.Y.Z tag → the package publishes. That's the whole flow.

There is no token to create

Worth stating up front, because it changes what we ask for: pub.dev automated publishing uses short-lived OIDC tokens minted per run, not a stored secret. Nothing to put in repo secrets, nothing to rotate, nothing to leak.

The trigger has to stay push: tags — pub.dev only honours the OIDC token for tag-triggered runs, so workflow_dispatch and release would both fail auth. That constraint is commented in the file so nobody "simplifies" it later.

One-time setup on pub.dev

pub.dev → dotlottie_flutterAdmin tab → Automated publishing → enable publishing from GitHub Actions:

  • Repository: LottieFiles/dotlottie-flutter
  • Tag pattern: v{{version}}

The package is under the lottiefiles.com verified publisher, so this needs an admin of that publisher.

Why the official reusable workflow

dart-lang/setup-dart/.github/workflows/publish.yml@v1 is what dart.dev recommends, and it matters here that it sets up the Flutter SDK, not just Dart — this package has sdk: flutter dependencies, so a plain dart pub get would fail version solving. The reusable workflow's inner actions are already SHA-pinned upstream. It runs a dry-run before publishing.

Deliberately not included: automated version bumps

Considered changesets, but it's @changesets/cli — npm-ecosystem, and adopting it means a Node toolchain in a Dart repo purely to manage a CHANGELOG. The Dart-native analogue is release-please with release-type: dart, which bumps pubspec.yaml and updates CHANGELOG.md from our conventional commits (we already write fix: / feat: / chore:).

It's left for a follow-up because of a chaining problem worth solving on its own: GitHub does not trigger workflow runs from events created with the default GITHUB_TOKEN, so a tag pushed by release-please would not fire this workflow. Fixing that needs a PAT — reintroducing exactly the long-lived secret OIDC just removed. Open question for that follow-up: whether pub.dev will authorise a run triggered by release-please's tag at all.

Version bumps stay manual for now; everything after the tag is automated.

This does not apply retroactively to v0.1.6

Workflows for a push: tags event are read from the tagged commit's tree, not from the default branch. v0.1.6 points at 826c8db, which predates this file, so that tag cannot be published by this workflow — re-pushing it would fire nothing.

0.1.6 was therefore published manually. This pipeline takes effect from the next version tag.

(This is also why the trigger is commented as load-bearing: the workflow must exist in the commit being tagged.)

Adds a tag-triggered workflow that publishes the package to pub.dev via
the official dart-lang/setup-dart reusable workflow. Authentication uses a
short-lived OIDC token minted per run, so there is no secret to store or
rotate; pub.dev only honours that token for tag-triggered runs, which is
why the trigger cannot be workflow_dispatch or release.

Requires a package admin to enable Automated publishing on pub.dev for
LottieFiles/dotlottie-flutter with tag pattern v{{version}}.
@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ba8de83

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant