zth / rescript-relay-router

MIT License
16 stars 3 forks source link

Set-up automated versioning and publishing with changesets #83

Closed Kingdutch closed 2 years ago

Kingdutch commented 2 years ago

The below commits set-up changesets for version management of our packages and the creation of a PR to help in automated publishing. Additionally it adds a workflow for nightly snapshot publishing (at 2 AM UTC) if there have been commits in the past 24 hours.

To complete set-up the following steps must be taken by the repository maintainer:

Set-up changesets

Changesets allows us to manage the versioning of the packages in our repository and can help us with releasing.

Additionally changeset files allow us to describe changes and their impact on package versions to influence how versioning will happen and keep track of a changelog.

A few configuration changes have been made with respect to the default configuration. The docs for config can be found at https://github.com/changesets/changesets/blob/main/docs/config-file-options.md

Add automated publishing workflow

This adds a release workflow. The workflow is based on https://github.com/changesets/action#with-publishing

To complete setup we must add a GITHUB_TOKEN and NPM_TOKEN (without 2FA for publishing) to the GitHub repository secrets.

The workflow will create a pull request when new changesets are found on the main branch. When this pull request is merged the versions of packages will be updated and a new release on NPM will be created automatically. When more changes are added to the main branch the pull request will automatically be updated.

Add GitHub action to publish nightly snapshot releases

This makes it easier for contributors to test changes that were merged in their own project by publishing nightly builds to NPM under the experimental tag.

We run this nightly but only actually publish a new snapshot if there have been commits in the last 24 hours.