Skip to content

[code-infra] Setup workflow to publish internal packages#47952

Open
brijeshb42 wants to merge 18 commits intomui:masterfrom
brijeshb42:canary-publish
Open

[code-infra] Setup workflow to publish internal packages#47952
brijeshb42 wants to merge 18 commits intomui:masterfrom
brijeshb42:canary-publish

Conversation

@brijeshb42
Copy link
Copy Markdown
Contributor

@brijeshb42 brijeshb42 commented Mar 11, 2026

whenever a new commit lands in master.

Currently, kept it manual with workflow_dispatch check. Don't want to publish packages as soon as it gets merged. I'll trigger it manually to do some testing and then after some time, check the check to also include push check.

One other major change - Renamed @mui/docs to @mui/internal-core-docs and moved this and other internal packages to packages-internal.

@brijeshb42 brijeshb42 requested a review from a team March 11, 2026 17:02
@brijeshb42 brijeshb42 added the scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). label Mar 11, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Mar 11, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against b70b06d

pnpm code-infra publish-canary --package @mui/internal-markdown @mui/docs @mui/internal-scripts @mui-internal/api-docs-builder @mui/internal-docs-utils

publish:
if: github.event_name == 'workflow_dispatch'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we want to use workflow_dispatch to test the canary publishing?

Copy link
Copy Markdown
Contributor Author

@brijeshb42 brijeshb42 Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean for the new job publish-internal ? I can add the workflow_dispatch check there as well if desired. I don't see the need.
As soon as this PR gets merged, it'll trigger a publish anyways and can be tested there. And you cannot trigger manually from a branch anyways for testing.

I have explicitly kept workflow_dispatch check in the previous publish job since I also added the on.push.branches trigger.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe with workflow_dispatch it's possible to test a change in a PR without merging first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Seems for that this needs to exist first in the main branch then we can trigger for next PR. I'll add the check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Because you choose the workflow to trigger from github actions page list first. It'll be shown as two separate items in the workflow list.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure, that's not my experience when trying the "Publish packages" workflow_dispatch in mui-public. Maybe I'm looking at the wrong thing.

Also, when we're calling this from CLI, won't it also trigger canary publishing along side regular publishing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I am not sure. I am moving this to its own file just to make sure there is no scenario of what you mention. I can verify after merge from the Actions UI, what it shows.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am moving this to its own file

That's not possible, trusted publishing needs to be configured with a workflow file to publish from, and only one file can be configured.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then looks like one more input is needed from user side on the workflow to decide which job to trigger.

@brijeshb42 brijeshb42 requested a review from Janpot March 12, 2026 09:33
@brijeshb42 brijeshb42 force-pushed the canary-publish branch 2 times, most recently from 7b45015 to 96c38da Compare March 12, 2026 15:51
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 13, 2026
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 16, 2026
@brijeshb42 brijeshb42 force-pushed the canary-publish branch 4 times, most recently from 47bf6be to eda494a Compare March 19, 2026 18:28
description: 'Run in dry-run mode without actually publishing packages'
required: false
type: boolean
default: false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing github release since its not relevant here and tag input since it'll always be canary.

required: false
type: string
default: 'latest'
internal-packages-only:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, but the name seems to imply that when this is false, both internal and public are published.

@Janpot
Copy link
Copy Markdown
Member

Janpot commented Mar 20, 2026

Now I remember what the problem was, we've set up a github actions environment that mandates a manual approval. This is configured in trusted publishing as well.

@brijeshb42
Copy link
Copy Markdown
Contributor Author

brijeshb42 commented Mar 20, 2026

Do we want to add the environment for internal packages as well ? I don't see it configured for mui-public here.

@Janpot
Copy link
Copy Markdown
Member

Janpot commented Mar 23, 2026

Do we want to add the environment for internal packages as well?

Ideally we don't, but environment has to be configured in the trusted publishing settings on npm. In mui-public packages, the environment is not configured on npm.

edit: just noticed there's a new feature that could allow us to create custom protection rules. We'll have to look into this.

edit 2: ok, I was talking nonsense, hadn't taken my shower yet. I was operating under the assumption @mui/docs still needed to be published through the regular flow. But what we could try is to split the packages exclusively in two, the public ones that only publish through the regular release flow, and the code infra ones that only publish through the canary flow. (to note that we should make sure there can never be workspace: dependencies between the two). The latter we publish with an npm-publish-internal environment, which doesn't include the manual review, but which only allows for publishing from master branch.

@brijeshb42
Copy link
Copy Markdown
Contributor Author

brijeshb42 commented Mar 23, 2026

the public ones that only publish through the regular release flow

This means that we need to filter out the internal/docs ones from the normal release flow so that these packages don't have two releases. I'll check what needs to be changed to filter out specific packages from the code-infra publish command.

@Janpot
Copy link
Copy Markdown
Member

Janpot commented Mar 23, 2026

This means that we need to filter out the internal/docs ones from the normal release flow so that these packages don't have two releases.

Yep, otherwise one of the publishes for that double package will fail due to publishing from a different environment than configured.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 25, 2026
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels Mar 26, 2026
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 26, 2026

jobs:
publish-internal:
# Keeping it manual trigger only for now. Will update to also include ` || (github.event_name == 'push' && github.event.head_commit.author.name != 'renovate[bot]')` once we are ready to publish internal packages on push as well.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good idea

…ackages-internal/`

- Rename package: `@mui/docs` → `@mui/internal-core-docs`
- Move directory: `packages/mui-docs/` → `packages-internal/mui-internal-core-docs/`
- Update all import references across docs/, packages/, and config files
- Update tsconfig.json, babel.config.mjs, eslint.config.mjs path aliases
- Update .github/workflows/publish.yml filter flags
- Update tsconfig.build.json references to use correct relative paths from new location
- Run pnpm install to register new workspace package location
The wildcard "./*" only resolves to index.ts files, so the non-index
`src/ApiPage/private.ts` entry-point was missing from the generated
build/package.json, causing the docs production build to fail.
…`packages-internal/`

- Add `@mui-internal/api-docs-builder` and `@mui-internal/api-docs-builder-core`
  path aliases to root tsconfig.json (used by docs and other consumers)
- Add explicit `@mui/internal-markdown/prism` alias pointing to prism.d.mts
  (not found via wildcard due to .mts extension)
- Add self-referencing path aliases in api-docs-builder's own tsconfig.json
  to resolve `@mui-internal/api-docs-builder` internally under nodenext resolution
@brijeshb42 brijeshb42 requested a review from a team March 27, 2026 09:23
@brijeshb42 brijeshb42 requested a review from Janpot March 27, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants