Skip to content

Support {package} placeholder in publish.yml working-directory - #207

Open
mosuem wants to merge 3 commits into
mainfrom
auto-locate-package
Open

mosuem wants to merge 3 commits into
mainfrom
auto-locate-package

Conversation

@mosuem

@mosuem mosuem commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Note

This PR was generated by an AI coding agent (Jetski) on behalf of @mosuem.

Allow monorepos to publish packages from <package>-v<version> release tags using a single .github/workflows/publish.yaml call to dart-lang/setup-dart/.github/workflows/publish.yml with the {package} placeholder in working-directory, without requiring either a separate publish_<pkg>.yaml per package or a separate caller job to compute working-directory (see discussion in dart-lang/tools#2773 (comment)).

Example

name: Publish

on:
  push:
    tags:
      - '*-v[0-9]+.[0-9]+.[0-9]+*'

jobs:
  publish:
    permissions:
      id-token: write
    uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
    with:
      working-directory: pkgs/{package}
      use-flutter: false

When tag foo-v1.2.3 is pushed, the literal {package} placeholder is replaced with foo, resolving working-directory to pkgs/foo.

Changes

  • validate (Resolve package directory step):
    • Expands {package} from <package>-v<version> tags (github.ref_name).
    • Rejects path traversal outside the repository and missing pubspec.yaml.
    • Exposes outputs.working-directory from validate and wires package to consume needs.validate.outputs.working-directory.
  • Tests:
    • Adds test/publish_workflow_test.dart covering single-package repos, {package} expansion (pkgs/{package} and {package}), invalid tags, missing pubspec.yaml, explicit subdirectories, and path traversal checks.
    • Runs dart test in .github/workflows/build.yml.

@mosuem mosuem changed the title Support monorepo package resolution from release tags in publish.yml Support {package} placeholder in publish.yml working-directory Nov 3, 2026
@mosuem
mosuem requested a review from sigurdm November 3, 2026 04:11
@mosuem
mosuem force-pushed the auto-locate-package branch from 49d6dbf to 02bd921 Compare November 16, 2026 12:17
@mosuem mosuem changed the title Support {package} placeholder in publish.yml working-directory Support {package} placeholder and globs in publish.yml working-directory Nov 16, 2026
@mosuem
mosuem force-pushed the auto-locate-package branch from 02bd921 to 311f837 Compare November 16, 2026 12:22
@mosuem
mosuem requested review from kevmoo and removed request for sigurdm November 18, 2026 13:02
@mosuem mosuem changed the title Support {package} placeholder and globs in publish.yml working-directory Support {package} placeholder in publish.yml working-directory Nov 18, 2026
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