GitHub Workflow: publishing changed packages to NPM registry
See original GitHub issueIssue Description
Now that we’re using a monorepo & Lerna (https://github.com/colyseus/colyseus/pull/419) to manage internal Colyseus’ packages, we need to establish a way to auto-publish updated packages on NPM.
As we are using independent mode, each package can evolve on its own versioning numbers. Every 0.14.x
version should be compatible with each other. Once we introduce a breaking change - the core and all its internal packages are going to be bumped to the next version (e.g. 0.15.x
)
Lerna built-in versioning and publishing tools seems to be centered around a “fixed” version number for every package, not really friendly with the “independent” mode.
- Because of that, I’m currently having to manually run
npm publish
for each package that has been changed- (a GitHub Workflow could handle this)
- I manually update the
"version"
number ofpackage.json
for that package, too.- (This step is fine, it gives us control)
As you can see, the colyseus
bundle package uses ^
for specifying the version number of its dependencies. So if an internal package gets updated, (e.g. "@colyseus/ws-transport"
is bumped to 0.14.99
) - it is optional for consumers if they want to upgrade it or not.
https://github.com/colyseus/colyseus/blob/a404b0fe9113392ed4c1cae7918ccd79aedc0350/bundles/colyseus/package.json#L34-L37
This thread has some useful information on approaches to take for “independent” versioning and CI: https://github.com/lerna/lerna/issues/1286
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
That’s looking really great @lpsandaruwan 👏 👏
Hi @endel
I created a script for capturing version changed packages and publish them for this.
Also a Github workflow to run this script.
Rough work is in https://github.com/lpsandaruwan/workflow-for-colyseus-test if you want to refer. Will integrate the workflow to the Colyseus repository and open a pull request describing what variables need to be added. Please advice if it requires changes. Thanks. 😃