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: semantic-release #1270

Merged
merged 6 commits into from Jan 20, 2022
Merged

ci: semantic-release #1270

merged 6 commits into from Jan 20, 2022

Conversation

gr2m
Copy link
Collaborator

@gr2m gr2m commented Sep 3, 2021

Follow up to #1257 (comment)

This pull request adds semantic-release. Once merged, GitHub/npm releases will be automated based on the following commit message conventions:

  1. fix: ... or fix(scope name): ... prefix in subject: bumps fix version, e.g. 1.2.31.2.4
  2. feat: ... or feat(scope name): ... prefix in subject: bumps feature version, e.g. 1.2.31.3.0
  3. BREAKING CHANGE: in body: bumps breaking version, e.g. 1.2.32.0.0

Only one version number is bumped at a time, the highest version change trumps the others.

Besides publishing a new version to npm, semantic-release also creates a git tag and release on GitHub, generates changelogs from the commit messages and puts them into the release notes, creates comments on pull requests included in the release as well as the issues they resolved to notify about the new release.

semantic-release with the current configruation supports releases to the @next channel and pre-relaeses using the next and beta branches. There are some gotchas here, but I'd say we get there when we get there.

I've been the maintainer of semantic-release for many years now, and I use it on nearly all my npm modules, I couldn't imagine doing Open Source without it. Let me know if you have any questions.

Todos

  • Delete the 3.x branch, it seems to be obsolete #1271
  • Update or recreate the 2.x branch #1272
  • Add NPM_TOKEN secret to the repository. I recommend creating a dedicated npm account that can only publish the node-fetch package. The bot account can have 2FA enabled, npm has automation tokens now that will work with semantic-release.
  • Document the commit conventions above somewhere. I'd usually add them to CONTRIBUTING.md, but we don't have one yet :)
  • Setup branch protection for v2.x, beta, next branches.

I would recommend

  • Disable all merge strategies but squash & merge. Do not ask contributors to fix their commit messages, we can just squash them into a single commit when merging.
  • Install the semantic-pull-request app
  • Configure semantic-pull-request with titleOnly: true.

@jimmywarting
Copy link
Collaborator

jimmywarting commented Sep 3, 2021

It sounds awesome, think i would like to incorporate it into my repos also

@jimmywarting
Copy link
Collaborator

jimmywarting commented Sep 3, 2021

Ping @bitinn

@jimmywarting
Copy link
Collaborator

jimmywarting commented Nov 10, 2021

ping @Richienb @xxczaki to take a look at this.

(Also could i have admin privileges?)

@xxczaki
Copy link
Member

xxczaki commented Nov 11, 2021

ping @Richienb @xxczaki to take a look at this.

(Also could i have admin privileges?)

Sorry, the last couple of months have been quite rough for me in terms of work. I've given you the admin privileges. When it comes to this PR, I will take a look at it this week (as well as some other issues/PRs).

@jimmywarting
Copy link
Collaborator

jimmywarting commented Dec 19, 2021

I created a dedicated npm account that can only publish the node-fetch package. it has 2FA enabled.

I have also generated a NPM_TOKEN and added it to the repository secret

@jimmywarting
Copy link
Collaborator

jimmywarting commented Jan 17, 2022

@gr2m what is left to do?

@gr2m
Copy link
Collaborator Author

gr2m commented Jan 18, 2022

I'll add a CONTRIBUTING.md and document the commit conventions there for maintainers. Then we need to do branch protections, I no longer have admin rights to this repository so I cannot do that myself. And I'd disable the "Rebase and merged" option to merge pull requests.

However, when merging next into main, we have to use "Create a merge commit". I usually enable the option specifically when needed only for this use case. I'll document it in CONTRIBUTING.md

@gr2m
Copy link
Collaborator Author

gr2m commented Jan 18, 2022

I'm set on my side, I do not have permission to do the rest. Feel free to make me an admin and I'll take care of the rest. I think I used to have the access rights, but they might have gotten lost with the transition to @node-fetch? I'm okay either way, let me know if you have any questions.

Once we are done here, I'll backport the setup to 2.x

@jimmywarting
Copy link
Collaborator

jimmywarting commented Jan 18, 2022

I gave u admin rights

@gr2m
Copy link
Collaborator Author

gr2m commented Jan 18, 2022

@jimmywarting can you do a final review? I added CONTRIBUTING.md with instructions on how to release new versions

Copy link
Collaborator

@jimmywarting jimmywarting left a comment

LGTM, maybe want a 2nd opinion on this?
pinging @LinusU

@jimmywarting jimmywarting requested a review from LinusU Jan 18, 2022
"branches": [
"+([0-9]).x",
"main",
"next",
Copy link
Member

@LinusU LinusU Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does next need any special config, like beta, or it is automatically picked up from the name?

Copy link
Collaborator Author

@gr2m gr2m Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's automatically picked up from the name

LinusU
LinusU approved these changes Jan 20, 2022
Copy link
Member

@LinusU LinusU left a comment

LGTM 👍

@jimmywarting jimmywarting merged commit b2f5d8d into main Jan 20, 2022
9 checks passed
@jimmywarting jimmywarting deleted the semantic-release branch Jan 20, 2022
@jimmywarting
Copy link
Collaborator

jimmywarting commented Jan 20, 2022

🎉 Merged 🎉

hope this makes more rapid releases now
guess we can go ahead and delete that changelog.md now

Looking forward to using this and hoping to learn a thing or two

@gr2m
Copy link
Collaborator Author

gr2m commented Jan 20, 2022

w00p :)

Don't hesitate to ping me for any questions, and in case something is acting up

guess we can go ahead and delete that changelog.md now

Yes, let's do that. I usually link to the latest version of the changelog.md from the first release notes that are created by semantic-release

@github-actions
Copy link

github-actions bot commented Jan 20, 2022

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants