Skip to content

Conversation

@ramu-narasinga
Copy link
Contributor

@ramu-narasinga ramu-narasinga commented Mar 21, 2025

In WIP, but the expected flow would look like something below - @hugs7. Will remove the WIP, once the testing is completed.

Related issue - #75

What this PR is about?

  1. Changesets initialized, you can see it from .changesets folder
  2. .github/workflows/npm-release.yml to automate the release to npm.

.changesets folder

The overall tool after initialization should lead to a loop that looks like:

  1. Changesets added along with each change
  2. The version command is run when a release is ready, and the changes are verified
  3. The publish command is run afterwards.

Example

I am demonstrating how this will be integrated with your release flow in this example by a series of steps. @hugs7

  1. Say, you want to add a new feature or fix a bug. You would create a new branch from main and make your changes
  2. Once you are done with your changes, you need to run the below command.
npx changeset

And this will prompt a few questions and answer them accordingly. This will be about the change you are making and whether it is patch, minor or major in semver versioning.

When you do this, this will add a file in .changesets folder and you should make sure to include this in your commit. This file is used to generate CHANGELOG.md for the releases made for your library.

Not every change needs to be added into changeset, documentation also tells the same thing - Not every change requires changesets

  1. Commit your changes. Again, make sure to include your .changesets folder as well and push to your branch
  2. Open a PR to main branch.
  3. When the PR is merged, .github/workflows/npm-release.yml takes care of the below things:
  • Create a new release according to semver - package version
  • Create a new tag according to semver - package version
  • Publish your package to the NPM.

Please read this documentation for more information

Research:

I pulled the workflows/npm-release.yml related code from https://github.com/Shopify/buy-button-js, did study other workflows but this Shopify release seemed simple and straightforward.

References:

  1. https://github.com/search?q=https%3A%2F%2Funpkg.com%2F%40changesets%2Fconfig%403.1.1%2Fschema.json&type=code
  2. https://github.com/Shopify/buy-button-js
  3. Upgrade to JS Buy SDK v3 Shopify/buy-button-js#888
  4. Shopify/buy-button-js@ce45985
  5. https://github.com/Shopify/buy-button-js/blob/1a1da6ff108085c04855ed15da869acbf4f436b7/.github/workflows/npm-release.yml
  6. https://github.com/Rich-Harris/dts-buddy/blob/a6e923d662e11c4bc59c921aa33699af32f21605/.github/workflows/release.yml
  7. https://github.com/t3-oss/t3-env/blob/main/.github/workflows/release.yml

@hugs7 hugs7 added the documentation Improvements or additions to documentation label Mar 21, 2025
@hugs7
Copy link
Owner

hugs7 commented Mar 29, 2025

Hi @ramu-narasinga , this is looking good. Are you able to fix the comment in my review and I'd be happy to merge

@hugs7 hugs7 requested a review from Copilot March 29, 2025 11:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR sets up the project's automated release flow using changesets with a new GitHub workflow and adds initial documentation for the changesets configuration.

  • Introduces .github/workflows/npm-release.yml for automating package version updates and NPM publishing upon PR merge.
  • Adds a README file in the .changeset folder to guide users on using changesets in the project.

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

File Description
.github/workflows/npm-release.yml Implements a workflow for version bumping, publishing to NPM, and handling changesets
.changeset/README.md Provides basic documentation about changesets and links to further info
Files not reviewed (2)
  • .changeset/config.json: Language not supported
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

.github/workflows/npm-release.yml:25

  • Using a shallow checkout (fetch-depth: 1) may lead to issues if changeset commands rely on commit history; consider increasing the fetch depth or removing the option to ensure all necessary commit data is available.
fetch-depth: 1

@ramu-narasinga ramu-narasinga changed the title WIP: feat: changesets config and github workflow setup feat: changesets config and github workflow setup Mar 29, 2025
@ramu-narasinga
Copy link
Contributor Author

Hey @hugs7 I have checked the comment, it is looking good too. I just removed the WIP from the title, please go ahead and merge it. Thanks.

@hugs7
Copy link
Owner

hugs7 commented Mar 29, 2025

Hey @hugs7 I have checked the comment, it is looking good too. I just removed the WIP from the title, please go ahead and merge it. Thanks.

Tagged you above

@ramu-narasinga ramu-narasinga requested a review from hugs7 March 29, 2025 12:00
@hugs7 hugs7 merged commit c69ef11 into hugs7:main Mar 29, 2025
@hugs7
Copy link
Owner

hugs7 commented Mar 29, 2025

Thank you @ramu-narasinga

@ramu-narasinga
Copy link
Contributor Author

Thank you @hugs7

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants