Skip to content

Publication to NPM

Bastien Gatellier edited this page Nov 7, 2022 · 5 revisions

Which packages are published?

The ones that satisfy the following conditions:

  • is listed in the projects key of the rush.json file, and does not have a "shouldPublish": false attribute.
  • has changes since the last release (has JSON changelogs located in the common/changes/@fabernovel directory)

Who can publish?

People who can push on the master branch, as stated in the Protected Branches settings of the repository.

What are the operations made during a publication?

  1. Update the changelogs (CHANGELOG.md, CHANGELOG.json)
  2. Update the packages version number
  3. Publish the packages to NPM

How to publish new packages version?

Because the publishing operation has important consequences (mainly because you cannot rollback it), several steps are deliberately manual.

  1. Create a new pipeline for the master branch

  2. Define 2 environments variables:

    • VERSION_POLICY, which indicates the version increment strategy you want to use. The list of strategies is located in common/config/rush/version-policies.json
    • PUBLISH, which indicates if you want to simulate or do the publication
    Variable Value Explanation
    VERSION_POLICY individualVersion Increments every package version number according to their own minor or patch increment (depends of the type of changes made to each package)
    VERSION_POLICY lockStepVersion Increments every package version number to the same major version. Only used for major releases.
    PUBLISH 0 Simulate a publication. Displays in the job log the commands that will be executed during a real publication
    PUBLISH 1 Publish to NPM
  3. Run the pipeline

  4. Click on the Play button of the Publish to NPM job, once the Deploy stage becomes available.

Clone this wiki locally