Allow arbitrary publish steps
See original GitHub issueAffected Packages
pkg:cli
Problem
I would like to use changesets to trigger deployments of some packages, rather than publishing to NPM. My immediate use case is a Pulumi program, I would like to run pulumi up
instead of NPM publish.
Proposed solution
Adding changesets configuration into package.json.
changesets: {
"publish-required": "pulumi preview --expect-no-changes",
"publish": "pulumi up"
}
getUnpublishedPackages could then check for the existence of publish-required
and use it’s return code as a signal you are up to date. Otherwise "publish-state": "./scripts/get-publish-state.js",
could return publishedState and published version. (must be a node script, which can be required by changesets).
Then in publishAPackage, if a publish step is defined, it is run instead of npm publish. In addition, if the old / new version are passed as command line arguments to the commands defined in these hooks a package.json file could be used to wrap anything, docker, rust packages etc without the core of changesets having to change.
It could also open up the possibility of third party packages to enable the various ecosystems. maybe something like this:
changesets: {
"publish": "changesets-pulumi"
}
or
changesets: {
"publish": "changesets-docker"
}
changesets: {
"publish": "./publish.js"
}
Then that file could export getCurrentVersionInfo
and publish
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:14 (13 by maintainers)
Top GitHub Comments
For what it’s worth, I have been experimenting with this further to try and contribute results to this. My approach has actually aligned with @ianwalter 's suggestion. Here is the patch for what i’m currently working with.
This allows the private pacakges to be published, then in my GitHub actions workflow I just add
To the deployment steps.
This is something we want to do - #218. If someone wants to submit a PR for that, we’d happily accept it.
I don’t really see the value in Changsets itself letting you do this. It wouldn’t be very hard to use
@manypkg/get-packages
and implement your own publish script. It would mean that people doing this are less constrained(I can imagine some deployment scenarios where the API mentioned in https://github.com/atlassian/changesets/issues/399#issuecomment-649122163 might not work) and Changesets doesn’t need all this extra complexity and constraints on what we can do in the future with publishing.