Skip to content

Commit 0de3533

Browse files
authored
Fix publish workflow failing on the flutter_webrtc pin warning (#1140)
Every publish workflow run in this repo's history has failed with exit code 65. The dart-lang reusable publish workflow runs a non-interactive `dart pub publish`, which treats any validation warning as fatal. Our exact `flutter_webrtc` pin is intentional (the native WebRTC-SDK pods must match between the two packages) but always produces the 'should allow more than one version' warning, so the workflow can never succeed and every release so far has been published manually. This replaces the reusable workflow with an inline job that publishes with `--force`, which downgrades warnings to informational. `dart-lang/setup-dart` is kept solely for pub.dev auth: with `id-token: write` it mints a temporary pub.dev token from the GitHub OIDC token and registers it in the shared pub config, which the Flutter-side `dart pub publish` then picks up. The pub.dev trust configuration is based on repository and tag claims, not the workflow definition, so no changes are needed on the pub.dev side.
1 parent f61a3a0 commit 0de3533

2 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,52 @@ on:
2121

2222
jobs:
2323
publish:
24+
runs-on: ubuntu-latest
2425
permissions:
26+
contents: read # Checkout needs this back once any permission is declared
2527
id-token: write # Required for authentication using OIDC
26-
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
27-
# with:
28-
# working-directory: path/to/package/within/repository
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v6
31+
32+
- name: Check tag matches pubspec version
33+
run: |
34+
version=$(sed -n 's/^version: *//p' pubspec.yaml)
35+
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
36+
echo "Tag $GITHUB_REF_NAME does not match pubspec version $version"
37+
exit 1
38+
fi
39+
40+
# Mints a temporary pub.dev token from the GitHub OIDC token and
41+
# registers it in the shared pub config used by the publish step.
42+
- name: Setup Dart for pub.dev auth
43+
uses: dart-lang/setup-dart@v1
44+
45+
- name: Setup Flutter
46+
uses: ./.github/actions/setup-flutter
47+
48+
# The exact flutter_webrtc pin is intentional (native WebRTC-SDK pods
49+
# must match) but always triggers a pub validation warning, and pub
50+
# treats any warning as fatal without --force. Publishing needs --force
51+
# because of that, so this step makes sure the pin warning is the only
52+
# validation issue before the forced publish runs.
53+
- name: Validate package, only the flutter_webrtc pin warning is allowed
54+
run: |
55+
set +e
56+
output=$(dart pub publish --dry-run 2>&1)
57+
status=$?
58+
set -e
59+
echo "$output"
60+
if [ "$status" -eq 0 ]; then
61+
exit 0
62+
fi
63+
unexpected=$(echo "$output" | grep '^\* ' | grep -v 'dependency on "flutter_webrtc" should allow more than one version' || true)
64+
if echo "$output" | grep -q '^Package has 1 warning\.$' && [ -z "$unexpected" ]; then
65+
echo "Only the expected flutter_webrtc pin warning was found, continuing."
66+
exit 0
67+
fi
68+
echo "Validation found issues other than the expected flutter_webrtc pin warning, refusing to publish."
69+
exit 1
70+
71+
- name: Publish
72+
run: dart pub publish --force

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ Most regressions live in `lib/src/core/` (`room.dart`, `engine.dart`, `signal_cl
6060

6161
## Releases
6262

63-
Every PR needs a changeset file in `.changes/` (format: `patch|minor|major type="fixed|added|changed|..." "description"`); CI checks for it and runs `dart-apitool` against `main` to require a `major` changeset for breaking public-API changes. Releases are tag-driven (`vX.Y.Z`) and publish to pub.dev.
63+
Every PR that affects the published package needs a changeset file in `.changes/` (format: `patch|minor|major type="fixed|added|changed|..." "description"`); CI checks for it and runs `dart-apitool` against `main` to require a `major` changeset for breaking public-API changes. PRs that only touch CI workflows or repo tooling are exempt, a changeset would put noise in the user facing changelog. Releases are tag-driven (`vX.Y.Z`) and publish to pub.dev.

0 commit comments

Comments
 (0)