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: add release workflow #942

Closed
wants to merge 9 commits into from
Closed

Conversation

DaviDevMod
Copy link
Contributor

@DaviDevMod DaviDevMod commented May 10, 2022

Hello, I randomly stumbled in this issue #268 while I was taking a look at your project to get some inspiration.

For the past few days I've been dealing with automating the releases of one of my project and as soon I saw the issue, I thought I could give some help.

I just ported the changesets/changesets solution for my yarn workspaces to your pnpm project.

I did so with the help of some documentation:

I didn't fully tested the workflow because I would need a secrets.GITHUB_TOKEN and a secrets.NPM_TOKEN but I am confident that it should work. Give it a try.

The way this should work is that whenever you want to add a changeset, you run pnpm changeset and follow the instructions.
Then commit the autogenerated changeset and push to main.
The push triggers a release workflow that will create a PR with the changeset, or if there was a PR already open it will just add commits to that PR.
Once you merge the PR, a new release of your package is automatically published to both NPM and GitHub.

You can customize stuff and probably you also want to adopt this beatiful changeset-bot.

@DaviDevMod DaviDevMod requested a review from a team May 10, 2022 02:40
@DaviDevMod DaviDevMod requested a review from a team as a code owner May 10, 2022 02:40
@codecov
Copy link

codecov bot commented May 10, 2022

Codecov Report

Merging #942 (701b5ec) into main (fb55728) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #942      +/-   ##
==========================================
- Coverage   99.65%   99.65%   -0.01%     
==========================================
  Files        1957     1957              
  Lines      209831   209831              
  Branches      878      877       -1     
==========================================
- Hits       209112   209109       -3     
- Misses        699      702       +3     
  Partials       20       20              
Impacted Files Coverage Δ
src/modules/finance/index.ts 99.31% <0.00%> (-0.69%) ⬇️

@DaviDevMod DaviDevMod changed the title chore(workflows): Add release workflow feat(workflows): Add release workflow May 10, 2022
@ejcheng ejcheng added c: feature Request for new feature c: chore PR that doesn't affect the runtime behavior p: 1-normal Nothing urgent s: needs decision Needs team/maintainer decision labels May 10, 2022
@ejcheng ejcheng added this to the v7 - Current Major milestone May 10, 2022
…ngesets to commit ('.changeset/**') and at the same time allow the release workflow to run when the PR is merged ('packages/**/CHANGELOG.md')
@DaviDevMod
Copy link
Contributor Author

I guess the prepublishOnly script could be removed.
And you may also want to add some caching logic to the workflow, but I leave it up to you. It's a very light workflow which wouldn't even run as often as the others.

@ST-DDT
Copy link
Member

ST-DDT commented May 11, 2022

Just to give you some feedback. We will discuss this in our team meeting next week (Thursday).

@DaviDevMod
Copy link
Contributor Author

@ST-DDT I do appreciate the feedback. Thank you.

@Shinigami92
Copy link
Member

I currently not have the time to look into it to deep but one of my first questions would be if standard-version is still needed or if this also create it's own way of changelog 🤔

Not to fully count that this PR will get merged some day, but we should use node 18 instead of 16 and you are right about that we may remove the prepublishOnly and release step unless otherwise needed.

@DaviDevMod
Copy link
Contributor Author

DaviDevMod commented May 12, 2022

@Shinigami92 yes it creates changelogs. I believe it would just add new ones at the top of your existing CHANGELOG.md

When you push a commit that has a new changeset, it gets committed as usual, but the workflow sees there is a new changeset and creates (or updates) a PR which contains:

  • the various additions to the CHANGELOG.md
  • the removal of all the changesets
  • a version bump in package.json

You can modify the PR in any way, like editing the changes or the title.

Once the PR is merged you get the updated CHANGELOG.md and the version bump in main. The changesets are gone and a new release will be found on NPM and GitHub.

Now that I think about it, the workflow can run just for .changeset/**, there is no need for that CHANGELOG.md.
I am going to modify the paths in the workflow and apply the changes you mentioned.

@DaviDevMod
Copy link
Contributor Author

DaviDevMod commented May 12, 2022

By the way I played around on my fork trying to publish a release, but the workflow keeps trying to release at faker-js rather than davidevmod, and obviously fails because it doesn't have the permission. Probably it's just a question of modifying names in the package.json but I don't care that much, the PR gets generated so the workflow is probably fully functional.

@xDivisionByZerox xDivisionByZerox added the c: infra Changes to our infrastructure or project setup label Jul 28, 2022
@ST-DDT ST-DDT added the needs rebase There is a merge conflict label Aug 5, 2022
@Shinigami92 Shinigami92 linked an issue Aug 12, 2022 that may be closed by this pull request
@Shinigami92 Shinigami92 changed the title feat(workflows): Add release workflow ci: add release workflow Aug 12, 2022
@ST-DDT
Copy link
Member

ST-DDT commented Sep 8, 2022

We will stay with the current way of generating changelogs.
Also this gotten stale, so closing for now.

@ST-DDT ST-DDT closed this Sep 8, 2022
@DaviDevMod
Copy link
Contributor Author

That's alright, hope you find a workflow that fits your needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: chore PR that doesn't affect the runtime behavior c: feature Request for new feature c: infra Changes to our infrastructure or project setup needs rebase There is a merge conflict p: 1-normal Nothing urgent s: needs decision Needs team/maintainer decision
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Automatic npm publish on commit
5 participants