← Back to Pull requests

Add the pub.dev release workflow (tag v<version>, OIDC) and its guards #52

Closed
unknown closed this pull request without merging on Nov 26, 2026 17:00 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 14:04 UTC
Author

What

A release pipeline that publishes both packages to pub.dev from one pushed tag. Pipeline and guards only: nothing was published, tagged, or configured on pub.dev or GitHub.

  • Trigger: push of a tag v<version> (the 9.x form). Both packages release lock-step from that one tag; pub.dev's tag pattern is v{{version}} for each.

  • Auth: pub.dev automated publishing (GitHub OIDC), no secrets. Verified against dart.dev/tools/pub/automated-publishing: it needs id-token: write, works only for an existing package, and pub.dev rejects publishing from a run not triggered by a tag push.

  • gate (read-only, no token, no environment): tag commit reachable from origin/main; tag == both pubspec versions == both CHANGELOG top entries (scripts/check_release.sh); ci-ok is green on the commit; on Flutter 3.50.0: format, both Pigeon checks, option registry check, analyze + test (root and feedback), flutter pub publish --dry-run, check_pub_archive.sh on the core archive, publish_feedback.sh dry run.

  • publish-core (needs gate, tag push only, environment: pub.dev, id-token: write): dart-lang/setup-dart (it mints the pub.dev credential PUB_TOKEN from the OIDC token; checked in its source, subosito/flutter-action does not), then flutter pub publish --force; skipped if that version is already live (safe re-run).

  • publish-feedback (needs gate + publish-core, same environment): waits up to 20 min for the core to be live on pub.dev, then setup-dart again (the credential is short-lived), then scripts/publish_feedback.sh --publish --yes (keeps its refusals: dirty tree, copy of tracked files, archive check). New --yes = pub's --force, only valid with --publish.

  • First version of the feedback package: a new package cannot use automated publishing, so if it is not on pub.dev yet the job skips with a warning and step summary (explicit, not silent) after the core is out.

  • Manual run (workflow_dispatch, dryRun default true): runs the whole gate (which includes the dry runs of both packages and prints what pub.dev has); the publish jobs are tag-push only (if:), so the environment's tag rule never sees a branch. dryRun: false is refused in the first step because pub.dev would refuse it anyway.

  • Publish jobs check out github.sha (not the tag's current target); concurrency group release for tag pushes (never cancelled; GitHub keeps one pending run, so a third push replaces the pending one), a separate group per rehearsal; every job has timeout-minutes; persist-credentials: false; actions pinned the way the other workflows pin them.
  • Guards (same change, reason: publishing is now legitimate, so the rule became where it may sit)

    nothing publishes: pub publish is always a dry run is replaced by only the release workflow publishes, only under the environment, only after the gate: a real publish must be in release.yml, in a job with environment: pub.dev, id-token: write and needs: [gate…], in a step that runs only on a tag push; id-token: write appears nowhere else. A mutation test shows each break failing (publish in ci.yml, token in ci.yml or in the gate, no environment, no token, no needs gate, a publish step reachable from a manual run or by ||, always()/continue-on-error past a failed gate, a dry run chained to a real publish, no setup-dart before the publish); status reads keep their exit code. New tests also pin the trigger, dry-run default, concurrency, that the gate repeats ci.yml's format/codegen commands, and that everything runs on the floor. test/release_scripts_test.dart runs check_release.sh (mismatch in any one of the four copies is refused) and pub_dev_status.sh (against a local server; a 5xx or unreachable server is an error, never "missing"). The other guards are unchanged (least-privilege now permits only the id-token: write lines of the publishing jobs in release.yml).

    Docs: .github/CI.md ("Releases"), PLAN.md release checklist (step 0 setup, step 7 now "tag and let the workflow publish", manual fallback kept), .claude/CLAUDE.md, doc/design-rules.md.

    Verified locally

    actionlint and shellcheck clean; flutter analyze, full flutter test (1415), dart format on Flutter 3.50.0; on a clean tree: both Pigeon checks, option registry check, flutter pub publish --dry-run (0 warnings), core archive check, publish_feedback.sh dry run (0 warnings); check_release.sh against the current tree with a matching and a wrong tag; pub_dev_status.sh against the real pub.dev (live, missing version, missing package).

    Not verifiable without a real publish

    The OIDC exchange and pub.dev's acceptance (tag-pattern, environment claim); flutter pub publish --force from the workspace root and --force from the copy in publish_feedback.sh; the gate on ubuntu (the same analyze/test as ci.yml, which runs them on macOS); gh api .../check-runs with checks: read; fetch-depth: 0 exposing origin/main for a tag run. A workflow_dispatch rehearsal needs release.yml on main.

    Maintainer checklist before the first release

    pub.dev (package admin):

  • Publish the first version of bugsee_flutter_feedback by hand (new packages cannot use automated publishing): clean checkout of the release commit, Flutter 3.50.0, core already live, scripts/publish_feedback.sh --publish.

  • bugsee_flutter (publisher bugsee.com) > Admin > Automated publishing: enable GitHub Actions, repository bugsee/bugsee-flutter, tag pattern v{{version}}; tick "Require GitHub Actions environment" = pub.dev.

  • Same for bugsee_flutter_feedback.
  • GitHub (repo admin):

  • Settings > Environments: create pub.dev, add required reviewers, limit deployment tags to v.

  • Settings > Rules: tag ruleset on v (only maintainers create; no update or delete).

  • Merge this to main (the workflow must be on the default branch), then run release via Actions > Run workflow with dryRun true to rehearse.

  • Release: with ci-ok green on the main commit, push v<version> (versions in both pubspecs and CHANGELOGs must already match), approve the pub.dev environment, check both packages on pub.dev.
  • Note: #50 (10.0.0-beta.1) and #51 touch PLAN.md/CI.md/ci.yml; I will rebase as they land.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01WeiJxNbNUdWru1zs68bYV8

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: krassx Review duration: 4495m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #52"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%