Skip to content

chore: use signed commits when publishing packages through Lerna#653

Open
fnesveda wants to merge 1 commit into
masterfrom
chore/use-signed-commit-action-for-publishing
Open

chore: use signed commits when publishing packages through Lerna#653
fnesveda wants to merge 1 commit into
masterfrom
chore/use-signed-commit-action-for-publishing

Conversation

@fnesveda

Copy link
Copy Markdown
Member

When publishing new versions of packages, Lerna doesn't sign the commit in which it bumps the versions. Once we enforce commit signing everywhere, this would break.

This PR fixes it by not pushing the commit created by the publication, but rather recreating it through the signed-commit action. It also merges the publication and changelog sync into one commit.

@fnesveda fnesveda requested review from B4nan and l2ysho June 18, 2026 09:17
@fnesveda fnesveda self-assigned this Jun 18, 2026
@fnesveda fnesveda added the adhoc Ad-hoc unplanned task added during the sprint. label Jun 18, 2026
@github-actions github-actions Bot added the t-management Issues with this label belong to the CTO or engineering managers. label Jun 18, 2026

@l2ysho l2ysho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

my only concern is lerna itself. We had a problem few days ago with drift between tag of a package and real package version pushed to npm (#649 we were pointing to version which not existed) and I am not sure if this pipe can now recover if lerna publish fail (restart probably fails on pushing tags? ). Maybe we can do lerna stuff first and then sign?

@fnesveda

Copy link
Copy Markdown
Member Author

I think the workflow will be able to recover, because of the way lerna publish from-package works. The scenario would be:

  1. First workflow run
    i. lerna version is called, versions get bumped in package.jsons, comitted and pushed
    ii. lerna publish from-package is called, but fails, so there is a drift between code and NPM
  2. Second workflow run
    i. lerna version is called, but there are no new changes since the first workflow run, so no versions get bumped
    ii. lerna publish from-package is called, it checks whether the versions in package.jsons are present in NPM, it sees that they're not, so it publishes them

@fnesveda

Copy link
Copy Markdown
Member Author

@B4nan if you could also take a look, I'd be glad. I think we'll need to use this approach in other repositories with Lerna, like Crawlee, so I'd like more eyes on this.

@B4nan

B4nan commented Jun 24, 2026

Copy link
Copy Markdown
Member

Do we really need this? I mean, lerna has --sign-git-commit and --sign-git-tag flags, also this might work universally:

git config --global commit.gpgsign true
git config --global tag.gpgsign true

@fnesveda

Copy link
Copy Markdown
Member Author

Do we really need this? I mean, lerna has --sign-git-commit and --sign-git-tag flags, also this might work universally:

git config --global commit.gpgsign true
git config --global tag.gpgsign true

That means we'd have to have a signing key in the repo secrets, which could leak, and it would be pretty hard to track down if it did.

This way we can push signed commits with an API token, which we can (and eventually will) generate through a GitHub app, so that it's temporary.

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

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-management Issues with this label belong to the CTO or engineering managers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants