Skip to content
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

ci: setup conventional commits & release automation #673

Merged
merged 10 commits into from Jul 20, 2023

Conversation

sheerlox
Copy link
Collaborator

@sheerlox sheerlox commented Jun 25, 2023

Purpose of the changes

In order to improve the maintainability and velocity of this project, I suggested we implement an automatic release pipeline.

To support this automation feature, I've set up the repository to follow the Conventional Commits formatting standard. This allows any commit to be parsed programmatically, and the release type (major, minor, patch) associated with a group of new commits to be determined automatically.

For more information on the different commit types and their associated releases, please check the table listing from the configuration preset.

Once those changes are merged to master:

  • new commits on master will automatically be linted (locally with a pre-commit hook) to ensure they follow the formatting standard.
  • commits on other branches won't be linted, instead, the PR title will be linted (removing overhead for contributors). If the PR title isn't compliant, an explanation message will automatically be posted on the PR.
  • any commit pushed to the master branch will trigger a Test & Release workflow (unless [skip ci] is present in the commit title) that will analyze the commits since the last version, automatically determine the necessary version bump, and handle the whole release process (updating package.json & package-lock.json, generating new CHANGELOG.md entries, publishing Github tag & release, then publishing the new version to npm).

Todo before merging the PR:

  • create a git tag for v2.3.1 (pointing to 988f7f2)
  • only allow squash merging PRs (cf screenshot below)
  • setup branch protection for master (cf screenshot below)
    • go to https://github.com/kelektiv/node-cron/settings/branches and create/update branch protection for master with (at least) the following options:
      • "Require a pull request before merging"
      • "Dismiss stale pull request approvals when new commits are pushed"
      • "Require status checks to pass before merging"
      • "Require branches to be up to date before merging" > then find and select all "lint-and-test" workflows (should be 9 of them + "Lint PR title" + "security/snyk").
      • "Require conversation resolution before merging"
      • "Require linear history"
      • make sure "Do not allow bypassing the above settings" is unchecked, else the automatic release commits won't work
  • setup Github PAC for the repository (required because of limitations with the default access token when branch protection is enabled)
    • go to https://github.com/settings/personal-access-tokens/new
    • set Expiration in one year (custom)
    • select the right resource owner (should be "kelektiv")
    • under "Repository" access, select "Only select repositories" and select only "node-cron"
    • under "Permissions", set "Contents", "Issues" and "Pull requests" to "Read and write"
    • the "Overview" section should look like this (cf screenshot below)
    • copy the generated token to a new CI_GITHUB_TOKEN repository secret on the Github repository
  • setup npm token for the package
    • go to https://www.npmjs.com/settings/{NPM_USERNAME}/tokens
    • "Generate New Token" > "Granular Access Token"
    • set Expiration to "365 days"
    • set Permissions to "Read and write", then click on "Only select packages and scopes" and select only "cron"
    • copy the generated token to a new NPM_TOKEN repository secret on the Github repository

Screenshots

disable merge commits in PR, only allow squash merging

image

setup branch protection for `master` *(required checks are not exactly the same in the screenshot)*

image

Github PAC > the "Overview" section should look like this

image

Notes

  • The "Squash and Merge" button should be the only one available when trying to merge this PR.

@sheerlox sheerlox force-pushed the ci/add-release-automation branch 2 times, most recently from f5f840d to 77b4d0e Compare June 25, 2023 13:32
@sheerlox sheerlox marked this pull request as ready for review June 25, 2023 17:21
@intcreator
Copy link
Collaborator

intcreator commented Jul 17, 2023

@ncb000gt we need some help for some more of these steps. I don't have perms for master branch protection or setting up GitHub PAC. if you want to set those up yourself you can or you can give me perms and I can do it. either way works, should just be a one time thing (well at least until next year when the tokens expire)

@intcreator intcreator requested review from intcreator and removed request for ncb000gt July 20, 2023 03:09
@intcreator intcreator merged commit c6f39ff into kelektiv:master Jul 20, 2023
10 checks passed
ncb000gt pushed a commit that referenced this pull request Jul 20, 2023
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-20)

### ⚠ Breaking changes

* UNIX standard alignments (#667)

### ✨ Features

* UNIX standard alignments ([#667](#667)) ([96ef954](96ef954))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
ncb000gt pushed a commit that referenced this pull request Jul 20, 2023
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-20)

### ⚠ Breaking changes

* UNIX standard alignments (#667)

### ✨ Features

* UNIX standard alignments ([#667](#667)) ([96ef954](96ef954))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
ncb000gt pushed a commit that referenced this pull request Jul 20, 2023
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-20)

### ⚠ Breaking changes

* UNIX standard alignments (#667)

### ✨ Features

* UNIX standard alignments ([#667](#667)) ([96ef954](96ef954))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
ncb000gt pushed a commit that referenced this pull request Jul 23, 2023
## [3.0.0-beta.1](v2.3.1...v3.0.0-beta.1) (2023-07-23)

### ⚠ Breaking changes

* UNIX standard alignments (#667)

### ✨ Features

* UNIX standard alignments ([#667](#667)) ([96ef954](96ef954))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
@ncb000gt
Copy link
Member

🎉 This PR is included in version 3.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

ncb000gt pushed a commit that referenced this pull request Jul 24, 2023
## [2.4.0](v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](d8a2f14))

### 🐛 Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](7e26c23))

### 🛠 Builds

* **npm:** ship type definitions with releases ([0b663a8](0b663a8))

### 🚨 Tests

* add test case for [#598](#598) fix ([4322ef2](4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](f0d5d3f))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
* wrap setTime tests in describe and move down ([31989e0](31989e0))
@ncb000gt
Copy link
Member

🎉 This PR is included in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

patrickm68 added a commit to patrickm68/node-cron-types that referenced this pull request Sep 14, 2023
## [2.4.0](kelektiv/node-cron@v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](kelektiv/node-cron@d8a2f14))

### 🐛 Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](kelektiv/node-cron@7e26c23))

### 🛠 Builds

* **npm:** ship type definitions with releases ([0b663a8](kelektiv/node-cron@0b663a8))

### 🚨 Tests

* add test case for [#598](kelektiv/node-cron#598) fix ([4322ef2](kelektiv/node-cron@4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](kelektiv/node-cron@f0d5d3f))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](kelektiv/node-cron#677)) ([c6fc842](kelektiv/node-cron@c6fc842))
* setup conventional commits & release automation ([#673](kelektiv/node-cron#673)) ([c6f39ff](kelektiv/node-cron@c6f39ff))

### ♻️ Chores

* update default branch name ([#678](kelektiv/node-cron#678)) ([7471e95](kelektiv/node-cron@7471e95))
* wrap setTime tests in describe and move down ([31989e0](kelektiv/node-cron@31989e0))
sheerlox pushed a commit that referenced this pull request Sep 27, 2023
## [2.4.0](v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](d8a2f14))

### 🐛 Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](7e26c23))

### 🛠 Builds

* **npm:** ship type definitions with releases ([0b663a8](0b663a8))

### 🚨 Tests

* add test case for [#598](#598) fix ([4322ef2](4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](f0d5d3f))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
* wrap setTime tests in describe and move down ([31989e0](31989e0))
sheerlox pushed a commit to sheerlox/node-cron that referenced this pull request Sep 27, 2023
## [2.4.0](kelektiv/node-cron@v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](kelektiv@d8a2f14))

### 🐛 Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](kelektiv@7e26c23))

### 🛠 Builds

* **npm:** ship type definitions with releases ([0b663a8](kelektiv@0b663a8))

### 🚨 Tests

* add test case for [kelektiv#598](kelektiv#598) fix ([4322ef2](kelektiv@4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](kelektiv@f0d5d3f))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([kelektiv#677](kelektiv#677)) ([c6fc842](kelektiv@c6fc842))
* setup conventional commits & release automation ([kelektiv#673](kelektiv#673)) ([c6f39ff](kelektiv@c6f39ff))

### ♻️ Chores

* update default branch name ([kelektiv#678](kelektiv#678)) ([7471e95](kelektiv@7471e95))
* wrap setTime tests in describe and move down ([31989e0](kelektiv@31989e0))
sheerlox pushed a commit to sheerlox/node-cron that referenced this pull request Sep 29, 2023
## [2.4.0](kelektiv/node-cron@v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](kelektiv@d8a2f14))

### 🐛 Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](kelektiv@7e26c23))

### 🛠 Builds

* **npm:** ship type definitions with releases ([0b663a8](kelektiv@0b663a8))

### 🚨 Tests

* add test case for [kelektiv#598](kelektiv#598) fix ([4322ef2](kelektiv@4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](kelektiv@f0d5d3f))

### ⚙️ Continuous Integrations

* add support for beta & maintenance releases ([kelektiv#677](kelektiv#677)) ([c6fc842](kelektiv@c6fc842))
* setup conventional commits & release automation ([kelektiv#673](kelektiv#673)) ([c6f39ff](kelektiv@c6f39ff))

### ♻️ Chores

* update default branch name ([kelektiv#678](kelektiv#678)) ([7471e95](kelektiv@7471e95))
* wrap setTime tests in describe and move down ([31989e0](kelektiv@31989e0))
@sheerlox sheerlox added type:ci Changes to CI configuration files and scripts and removed released on @beta labels Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released type:ci Changes to CI configuration files and scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants