Skip to content

Per-workspace placeholders for glob release workspaces #937

Closed

Description

@sentry-junior

Problem

A glob release-workspace key (e.g. static/packages/*) gives every matched directory the same settings (docs). None of the per-workspace fields support placeholders, so independently released packages each need a near-identical literal entry that differs only by name:

  • targets[github].tagPrefix (scraps@, icons@, search-syntax@)
  • releaseBranchPrefix (scraps/release, ...)
  • preReleaseCommand (npm --prefix static/packages/<name> ... version)
  • statusProvider.config.contexts (<name>-package-pack)
  • artifactProvider.config.artifacts (<name>-tarball)

The only templating today is {{name}} / {{simpleName}} / {{version}} in npm artifact matching for package workspaces (packageNameToArtifactFromTemplate in src/utils/workspaces.ts, at 3817aa2).

The same names also force one CI pack workflow per package, because each workflow's job name must match the status context Craft waits for.

Example

getsentry/sentry .craft.yml has literal entries for static/packages/scraps and static/packages/icons, and getsentry/sentry#128514 adds a third for static/packages/search-syntax. The entries are identical apart from the package name.

Proposal

Expand placeholders in workspace settings from the concrete workspace a glob matched, for example:

  • {{workspace}}: the workspace path (static/packages/scraps)
  • {{workspaceName}}: its basename (scraps)
  • {{packageName}} / {{simpleName}}: from the workspace's package.json when there is one (@sentry/scraps / sentry-scraps)

Then one entry could cover all three:

workspaces:
  static/packages/*:
    releaseBranchPrefix: '{{workspaceName}}/release'
    statusProvider:
      name: github
      config:
        contexts: ['{{workspaceName}}-package-pack']
    artifactProvider:
      name: github
      config:
        artifacts:
          Package: ['{{workspaceName}}-tarball']
    targets:
      - name: github
        tagPrefix: '{{workspaceName}}@'
      - name: npm
        access: public

Combined with #936 (scope the automatic version bump to the selected workspace), the preReleaseCommand could go away too. The CI side could then be a single pack workflow that picks the package from the release branch name.

Context: getsentry/sentry#128514 (comment)

via @BYK.

--

View Junior Session [Sentry]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions