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

chore(ci): add changesets #1581

Merged
merged 8 commits into from
Dec 18, 2021
Merged

chore(ci): add changesets #1581

merged 8 commits into from
Dec 18, 2021

Conversation

jeetiss
Copy link
Collaborator

@jeetiss jeetiss commented Nov 6, 2021

release automation with changesets

changesets provides an automated monopackage release flow with a review.

here are steps from PR to release:

  • a user creates PR
  • maintainer or user adds a changeset that contains a description and information about affected packages and release type (patch, minor, major) like this
  • GitHub action creates a pull request with generated changelogs and bumped versions for packages that are changed
  • release engineer reviews changes and merge them
  • GitHub action publishes the new versions to npm and creates a release note for all packages at github

Lerna has a similar release flow with semantic releases, but changeset is better because:

  • files are more flexible for change descriptions than commit messages
  • it has a review step that allows to check and change something at the last moment
  • it has all steps automation out of the box

TODOs

  • add changesets bot
  • add automation npm token for releases

@jeetiss jeetiss self-assigned this Nov 6, 2021
@diegomura
Copy link
Owner

@jeetiss can you explain the motivation of this? Isn't Lerna do some of this stuff already?

@jeetiss
Copy link
Collaborator Author

jeetiss commented Nov 12, 2021

@diegomura sure.
I'm finalizing our migration to v2, and after i'm back with motivation explanations and the new prs.

now v2 works the same as v1, and i'm happy that i don't need to rewrite components

@jeetiss jeetiss marked this pull request as ready for review November 21, 2021 11:45
version: yarn version-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Copy link
Collaborator Author

@jeetiss jeetiss Nov 21, 2021

Choose a reason for hiding this comment

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

@diegomura could you add NPM_TOKEN to github secrets? it should be an automation token that github announced couple days ago

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

GITHUB_TOKEN is provided on default, so you don't need to add it.

@jeetiss
Copy link
Collaborator Author

jeetiss commented Nov 21, 2021

@diegomura i add some explanation to PR description

Isn't Lerna do some of this stuff already?

yes, changesets is inspired by lerna but improves all aspects of release.

last thing. I tried to automate all possible things, so if you want to run some steps manually, just say and i prepare it here 😄

@jeetiss jeetiss merged commit 04449ab into master Dec 18, 2021
@jeetiss jeetiss deleted the add-changesets branch December 18, 2021 13:11
@github-actions github-actions bot mentioned this pull request Dec 18, 2021
@diegomura
Copy link
Owner

@jeetiss thanks for merging this and improving the release cycle. And also for all the hard work you are putting on the project. I'll try to be more responsive and present than I've been for the last weeks.

Can you quickly explain how this changes how to publish a new version? I'm not sure I grasped 100% of wht changesets does

@jeetiss
Copy link
Collaborator Author

jeetiss commented Jan 13, 2022

@diegomura hooray 🙌🏻

I am almost ready with the new release, I'm going to finish [this fix] (#1659) today, and after we can release

changesets

I can't explain it better than changesets maintainers do, so read this article

here are the changesets of all PRs that I merged

changeset's github action generates a PR with generated changelogs and bumped versions for all packages, based on these files, you can check PR here

I have finished the setup, but you need to add npm automation token with the name NPM_TOKEN to github secrets, for automated publishing to npm, this is the last step for release

here the screen
Снимок экрана 2022-01-13 в 13 53 42

@diegomura
Copy link
Owner

I kept reading about it and things make much sense now. Thanks! Just added the token. Does that token allows changelogs to publish any package under my name? How is it that releases through GH will work?

@jeetiss
Copy link
Collaborator Author

jeetiss commented Jan 14, 2022

thanks, it works ✨
https://github.com/diegomura/react-pdf/runs/4815869743?check_suite_focus=true#step:5:7

Does that token allows changelogs to publish any package under my name?

Yes, it can release all packages placed in this repository under your name.
It is secure, nobody can steal the token, and your secrets don't work in forks

How is it that releases through GH will work?

it should work like a magic ✨

when I merge PR

all changeset files will be removed and release github action run changeset publish because of that, it should release the new packages automatically ✨

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

Successfully merging this pull request may close these issues.

None yet

2 participants