-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(plugin-cli): integrate delegated releases with Changesets #3093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@emdash-cms/plugin-cli": minor | ||
| --- | ||
|
|
||
| Adds Changesets-aware automated plugin releases. `emdash-plugin release setup` detects a root `.changeset/config.json` and offers to follow Changesets releases, `<slug>@<version>` tags, or manual runs. Use `--trigger auto|changesets|tags|manual` in non-interactive setup. | ||
|
|
||
| The Changesets variant accepts the official Changesets Action published-package JSON through a reusable workflow. It supports mixed monorepos where npm package names differ from EmDash plugin IDs, ignores ordinary npm packages, verifies every reported plugin version, and publishes matching plugins as a matrix. Private EmDash-only packages produce a setup warning unless Changesets versions and tags them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -71,7 +71,9 @@ pnpm exec emdash-plugin validate | |||||
|
|
||||||
| The command creates `.github/workflows/emdash-release.yml`. It does not push the file and does not replace an existing workflow unless you pass `--force`. | ||||||
|
|
||||||
| The generated workflow runs for package tags matching `<slug>@<version>` and through `workflow_dispatch`. It grants `contents: read`, `id-token: write`, and `attestations: write`; pins third-party Actions to full commit identifiers; runs the exact plugin CLI version that generated the file; resolves one package from its manifest; builds one plugin bundle; creates GitHub build provenance for those exact bytes; and passes both files to the EmDash release Action. | ||||||
| If the repository contains `.changeset/config.json`, interactive setup offers **Follow Changesets releases**. When Changesets releases a package containing `emdash-plugin.jsonc`, the reusable EmDash workflow publishes the same version. Connect it to the existing Changesets workflow as described below. Otherwise, the generated workflow runs for package tags matching `<slug>@<version>`. Both variants support manual runs and can be selected explicitly with `--trigger changesets|tags|manual`. | ||||||
|
|
||||||
| The workflow grants each job only its required `contents`, `id-token`, and `attestations` permissions; pins third-party Actions to full commit identifiers; runs the exact plugin CLI version that generated the file; resolves each package from its manifest; builds one plugin bundle; creates GitHub build provenance for those exact bytes; and passes both files to the EmDash release Action. | ||||||
|
|
||||||
| The workflow lives at the repository root and is shared by every plugin package in that repository. Running `release setup` from a nested package still writes `.github/workflows/emdash-release.yml` at the root. | ||||||
|
|
||||||
|
|
@@ -81,7 +83,9 @@ pnpm exec emdash-plugin validate | |||||
|
|
||||||
| 5. Start the release workflow. | ||||||
|
|
||||||
| Update the package version before creating the version tag. The following commands start a `1.2.3` release: | ||||||
| With Changesets, merge the version pull request and let its publish job complete. The Changesets Action passes the packages it released to the reusable EmDash workflow. Ordinary npm packages are ignored; packages containing `emdash-plugin.jsonc` publish the same version to EmDash. | ||||||
|
|
||||||
| With the package-tag trigger, update the package version before creating the version tag. The following commands start a `1.2.3` release: | ||||||
|
|
||||||
| ```sh | ||||||
| git tag gallery@1.2.3 | ||||||
|
|
@@ -106,6 +110,56 @@ pnpm exec emdash-plugin validate | |||||
|
|
||||||
| </Steps> | ||||||
|
|
||||||
| ## Connect a Changesets workflow | ||||||
|
|
||||||
| The generated `.github/workflows/emdash-release.yml` accepts the Changesets Action published-package JSON through `workflow_call`. Add an output to the existing Changesets job, then call the EmDash workflow from a dependent job. Replace `release` and `changesets` when the existing job or step uses another ID. | ||||||
|
|
||||||
| Changesets Action v2 uses the `published-packages` output. Add the following job output and caller to a workflow using Changesets CLI v3: | ||||||
|
|
||||||
| ```yaml title=".github/workflows/release.yml" | ||||||
| jobs: | ||||||
| release: | ||||||
| # Keep the existing runner, permissions, and steps. | ||||||
| outputs: | ||||||
| published: ${{ steps.changesets.outputs.published }} | ||||||
| published-packages: ${{ steps.changesets.outputs['published-packages'] }} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [needs fixing] The canonical docs repeat the incorrect v2 step-output name. The Changesets Action output is
Suggested change
|
||||||
|
|
||||||
| publish-emdash-plugins: | ||||||
| needs: release | ||||||
| if: needs.release.outputs.published == 'true' | ||||||
| uses: ./.github/workflows/emdash-release.yml | ||||||
| with: | ||||||
| published-packages: ${{ needs.release.outputs['published-packages'] }} | ||||||
| permissions: | ||||||
| contents: read | ||||||
| id-token: write | ||||||
| attestations: write | ||||||
| ``` | ||||||
|
|
||||||
| Changesets Action v1 uses the camel-case `publishedPackages` step output. Use this expression for a workflow using Changesets CLI v2: | ||||||
|
|
||||||
| ```yaml title=".github/workflows/release.yml" | ||||||
| jobs: | ||||||
| release: | ||||||
| # Keep the existing runner, permissions, and steps. | ||||||
| outputs: | ||||||
| published: ${{ steps.changesets.outputs.published }} | ||||||
| published-packages: ${{ steps.changesets.outputs.publishedPackages }} | ||||||
|
|
||||||
| publish-emdash-plugins: | ||||||
| needs: release | ||||||
| if: needs.release.outputs.published == 'true' | ||||||
| uses: ./.github/workflows/emdash-release.yml | ||||||
| with: | ||||||
| published-packages: ${{ needs.release.outputs['published-packages'] }} | ||||||
| permissions: | ||||||
| contents: read | ||||||
| id-token: write | ||||||
| attestations: write | ||||||
| ``` | ||||||
|
|
||||||
| Keep Changesets responsible for its version pull request and package publication. The EmDash caller runs only when Changesets reports `published: true`. For private EmDash-only packages, set both `privatePackages.version` and `privatePackages.tag` to `true` in `.changeset/config.json`. Add unrelated private applications and test fixtures to `ignore`. | ||||||
|
|
||||||
| ## Add another package | ||||||
|
|
||||||
| Prepare the package profile from its source directory. The existing root workflow and repository connection are reused: | ||||||
|
|
@@ -114,14 +168,14 @@ Prepare the package profile from its source directory. The existing root workflo | |||||
| pnpm exec emdash-plugin profile setup --dir packages/comments | ||||||
| ``` | ||||||
|
|
||||||
| Update the package version, then push its package tag: | ||||||
| With Changesets, add the package to a changeset and merge its version pull request. With the package-tag trigger, update the package version and push its tag: | ||||||
|
|
||||||
| ```sh | ||||||
| git tag comments@1.0.0 | ||||||
| git push origin comments@1.0.0 | ||||||
| ``` | ||||||
|
|
||||||
| The workflow resolves `comments` to one `emdash-plugin.jsonc`, checks that the manifest version is `1.0.0`, and verifies that the signed profile names the connected repository before accepting artifact uploads. Duplicate package IDs and tag-version mismatches fail before attestation. | ||||||
| The workflow resolves `comments` to one `emdash-plugin.jsonc`, checks the selected version, and verifies that the signed profile names the connected repository before accepting artifact uploads. Duplicate package IDs and version mismatches fail before attestation. | ||||||
|
|
||||||
| ## What the release service verifies | ||||||
|
|
||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[needs fixing] The v2 caller example reads the Changesets step output as
steps.changesets.outputs['published-packages'], but@changesets/actionexposes the published-package list aspublishedPackages(camelCase) — the same output this repository already uses in.github/workflows/release.yml. Copying this snippet will pass an undefined value into the EmDash reusable workflow. Keep thepublished-packagesjob output name, but read from the upstream camelCase output.