diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 353c24f..c340c32 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,6 +2,13 @@ # Must be triggered by a tag push — pub.dev's trusted-publishing OIDC check rejects any # other ref type (e.g. workflow_dispatch on a branch), per # https://dart.dev/tools/pub/automated-publishing. +# +# Inlines dart-lang/setup-dart's reusable publish workflow (rather than calling it via +# `uses:`) so we can pass --ignore-warnings to `dart pub publish`. Pub's package-layout +# check always flags our top-level samples/ dir ("rename to example") regardless of +# whether an example/ dir also exists, and in non-interactive CI any warning otherwise +# fails the dry run. Keep the steps below in sync with +# https://github.com/dart-lang/setup-dart/blob/main/.github/workflows/publish.yml. name: 📦 Publish to pub.dev @@ -12,6 +19,22 @@ on: jobs: publish: + name: 'Publish to pub.dev' + runs-on: ubuntu-latest permissions: id-token: write # Required for authentication using OIDC - uses: dart-lang/setup-dart/.github/workflows/publish.yml@65eb853c7ba17dde3be364c3d2858773e7144260 # v1 + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + persist-credentials: false + - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c + - uses: flutter-actions/setup-flutter@d4e97a6e7467ef062618c9af927f90bc9651b876 + + - name: Install dependencies + run: dart pub get + + - name: Publish - dry run + run: dart pub publish --dry-run --ignore-warnings + + - name: Publish to pub.dev + run: dart pub publish -f