Skip to content

Commit 2207f5d

Browse files
committed
fix(ci): use tag push trigger for pub.dev OIDC publish
pub.dev requires push events for OIDC authentication. Changed publish.yml trigger from release:published to push:tags with reusable dart-lang/setup-dart workflow. Updated release command with dry-run gate and publish workflow monitoring.
1 parent af9668b commit 2207f5d

2 files changed

Lines changed: 33 additions & 37 deletions

File tree

.claude/commands/release.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,15 @@ Check README.md for any version-specific content that needs updating:
6363

6464
### Phase 5: Local Verification
6565

66-
1. Run `dart format --set-exit-if-changed .` — must be clean
67-
2. Run `dart analyze` — must be zero issues
68-
3. Run `flutter test` — must all pass
69-
4. Review all changed files with `git diff`
66+
Run all checks locally. ALL must pass before proceeding:
67+
68+
1. `dart format --set-exit-if-changed .` — must be clean
69+
2. `dart analyze` — must be zero issues
70+
3. `flutter test` — must all pass
71+
4. `dart pub publish --dry-run` — must be zero warnings
72+
5. Review all changed files with `git diff`
73+
74+
If **dry-run fails** → STOP. Fix the issue before proceeding. The dry-run catches the same errors that pub.dev OIDC publish would catch.
7075

7176
### Phase 6: Commit & Push
7277

@@ -76,7 +81,7 @@ Check README.md for any version-specific content that needs updating:
7681

7782
### Phase 7: Wait for CI
7883

79-
The push triggers the **CI & Deploy** workflow (Lint & Test) on GitHub. Wait for it to pass before creating the release.
84+
The push triggers the **Lint & Test** workflow (`deploy.yml`) on GitHub. Wait for it to pass before creating the release.
8085

8186
1. Get the run ID for the push commit:
8287
```bash
@@ -94,7 +99,11 @@ The push triggers the **CI & Deploy** workflow (Lint & Test) on GitHub. Wait for
9499

95100
### Phase 8: Create GitHub Release
96101

97-
CI is green. Create a GitHub Release using `gh` CLI. This automatically creates a tag, and the tag push triggers `publish.yml` → pub.dev publishing.
102+
CI is green. Create a GitHub Release using `gh` CLI. This does three things at once:
103+
104+
1. **Creates the GitHub Release** with changelog notes
105+
2. **Creates the git tag** (e.g. `1.0.0-alpha.4`)
106+
3. **Triggers `publish.yml`** — the tag push activates the pub.dev OIDC publish workflow
98107

99108
Determine if the version is a prerelease:
100109
- Contains `alpha` or `beta` or `rc` → add `--prerelease` flag
@@ -115,12 +124,22 @@ NOTES
115124
)"
116125
```
117126

127+
After creating the release, watch the publish workflow:
128+
129+
```bash
130+
# Wait a few seconds for the workflow to trigger
131+
gh run list --workflow=publish.yml --limit 1 --json databaseId,status,headSha --jq '.[0]'
132+
gh run watch {run_id} --exit-status
133+
```
134+
135+
If publish fails → report the error. The release and tag already exist — the user can fix and re-trigger manually.
136+
118137
### Output
119138

120139
Present a summary:
121140

122141
```
123-
## Release {version} Published
142+
## Release {version} Complete
124143
125144
**GitHub Release:** https://github.com/fluttersdk/wind/releases/tag/{version}
126145
@@ -133,8 +152,7 @@ Present a summary:
133152
134153
**Changelog:** {count} features, {count} fixes, {count} improvements
135154
155+
**Local:** ✅ Tests ({count} passed) · ✅ Analyzer (0 issues) · ✅ Format clean · ✅ Dry-run (0 warnings)
136156
**CI:** ✅ Lint & Test passed (run #{run_id})
137-
**Local:** ✅ Tests ({count} passed) · ✅ Analyzer (0 issues) · ✅ Format clean
138-
139-
**pub.dev:** Publishing triggered — check status: `gh run list --limit 1`
157+
**pub.dev:** ✅ Published (run #{publish_run_id}) — https://pub.dev/packages/fluttersdk_wind
140158
```

.github/workflows/publish.yml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
11
name: Publish to pub.dev
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+*'
67

78
jobs:
89
publish:
9-
runs-on: ubuntu-latest
1010
permissions:
11-
id-token: write
12-
steps:
13-
- uses: actions/checkout@v4
14-
15-
- name: Setup Flutter
16-
uses: subosito/flutter-action@v2
17-
with:
18-
channel: stable
19-
cache: true
20-
21-
- name: Install dependencies
22-
run: flutter pub get
23-
24-
- name: Analyze code
25-
run: flutter analyze
26-
27-
- name: Check formatting
28-
run: dart format --set-exit-if-changed .
29-
30-
- name: Run tests
31-
run: flutter test
32-
33-
- name: Publish
34-
run: dart pub publish --force
11+
id-token: write # Required for authentication using OIDC
12+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

0 commit comments

Comments
 (0)