-
Notifications
You must be signed in to change notification settings - Fork 21
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(tooling): add sanity ecosystem automation #55
Conversation
node-version: lts/* | ||
- run: corepack enable && pnpm --version | ||
- run: pnpm install --loglevel=error | ||
- run: pnpm release --dry-run --debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- run: pnpm release --dry-run --debug | |
- run: pnpm release |
After you've run this on the CI at least once, and verified that the output looks good and what it's intending to do, its predicted new version number and so on match your expectations, then it's a good time to remove --dry-run --debug
This is completely awesome! Thanks for the effort and all the clear documentation you provided. I think all the code is fairly clear, however i was wondering what would happen during the first time i release. How can i determine a follow-up of the existing version number, will the commit-analyzer pick up the changes as a major version change initially? I'll make sure to follow the steps you've provided and also change to pnpm, i'm already using that for all other projects so i like the change! |
The first time it runs it'll try and look at the package on npm as well as the git tags to determine what the current version is. I see that the current version is Then, to make a new release, you use commits like |
Great! I made sure to create a Thanks for the effort, and very nice we could get a collaboration going. Very cool to hear that this is used on the Sanity website, so i'd be happy to hear any feedback when using this library! |
馃帀 This PR is included in version 6.1.0 馃帀 The release is available on: Your semantic-release bot 馃摝馃殌 |
@stipsan wanted to let you know that we just ran the first release and it worked flawlessly! Thanks again for the effort 馃殌 |
Great to hear!! 馃帀 |
Hi 馃憢
As promised in sanity-io/next-sanity#5 (comment) here's a PR with the typical automation we use in our own libraries like
next-sanity
and@sanity/client
馃槃I'll keep the PR description brief, but please feel free to ask questions in diff comments and I'll do my best to fill you in on the deets 馃檱
TL;DR
The automation is for:
CHANGELOG.md
file with semantic-release.peerDependencies
let your consumers use the latest and notifies you if any.github/workflows/*.yml
files have shared actions that can be updated.main
.Next steps a maintainer with admin powers should do
Renovatebot
For Renovate to be enabled you need to install the app. We recommend enabling it on one repository at a time since it will create onboarding PRs on repos without a
renovate.json
file by default which can blast your email inbox and be really noisy.Once enabled you should see it create a GitHub issue like this: sanity-io/next-sanity#58
More information on the preset itself: https://github.com/sanity-io/renovate-presets/blob/main/ecosystem/README.md
Semantic Release
There's detailed information on our preset here: https://github.com/sanity-io/semantic-release-preset
![image](https://user-images.githubusercontent.com/81981/230079331-3c7ff5da-fd91-4da7-9053-bcc6fdb8a866.png)
Most importantly you'll need to create an
NPM_PUBLISH_TOKEN
withauth-only
2FA and add it to the repository secrets. And your npm package settings should setPublishing access
toRequire two-factor authentication or an automation or granular access token
:I noticed you're using a different git commit convention than ours. If you decide to adopt conventional commits then the next time you push a commit prefixed with
fix: the bug is gone
orfeat: images pop even more
then you can make a new release using this flow:how.to.release.mov
If you wish to stick to your current convention then, as semantic release presets don't really support merging presets, it's best to replace the
.releaserc.json
file in this PR with a new.releaserc.cjs
that have the contents of our preset: https://github.com/sanity-io/semantic-release-preset/blob/main/index.jsThe commit preset used is defined at the top. Here's a list over available presets: https://github.com/semantic-release/commit-analyzer#options
Please note that our Release preset currently requires the ability to directly push commits to
main
Specifically this means that all GitHub branch protection rules that require a PR to be made before you can push to
![image](https://user-images.githubusercontent.com/81981/230078024-21ac040e-9176-483e-b289-19807d5497b9.png)
main
, can't be used:As our preset will attempt to push a commit right after release that bumps the
version
in yourpackage.json
, adds another entry to theCHANGELOG.md
(or creates the file if it doesn't already exist), and pushes it right away.We're working on an updated preset that is compatible with PR based branch protection rules and will let you know when that's available 馃檱