Skip to content

ci: automate the v-next release process using changesets#6565

Merged
kanej merged 32 commits intov-nextfrom
v-next-release
May 14, 2025
Merged

ci: automate the v-next release process using changesets#6565
kanej merged 32 commits intov-nextfrom
v-next-release

Conversation

@galargh
Copy link
Contributor

@galargh galargh commented Apr 11, 2025

  • Because this PR includes a bug fix, relevant tests have been included.
  • Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
  • I didn't do anything of this.

This PR automates the release creation on the v-next branch. This includes publishing the packages to NPM registry and creating a GitHub release (in a draft mode).

TODO (before merge)
Testing

I performed manual testing in a forked repository. The testing did NOT include actually publishing the packages to npm. This is considered acceptable because in case the NPM publishing fails, we can always fall back to the manual release mode we've been following thus far.

Here are the testing scenarios I went through.

  1. I merged a PR marked with no changeset needed label. It was successfully validated in the PR and in the merge queue. After the merge, the release workflow did not publish the packages.
  2. I merged a PR with a new changeset. It was successfully validated in the PR and in the merge queue. After the merge, a release PR was updated. The release workflow did not publish the packages.
  3. I merged the release PR. The release PR correctly updated all the releasable packages (including those that are on the v4 major version already). The workflows on the PR were automatically triggered and it successfully passed the validation both in the PR and in the merge queue. After the merge, the release workflow performed a dry-run of the publishing to NPM and created a draft GitHub release.

@galargh galargh requested a review from Copilot April 11, 2025 08:38
@changeset-bot
Copy link

changeset-bot bot commented Apr 11, 2025

⚠️ No Changeset found

Latest commit: 7b58bd6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Apr 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 8:38am

Copy link
Contributor

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.

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

Files not reviewed (9)
  • .changeset/config.json: Language not supported
  • package.json: Language not supported
  • pnpm-lock.yaml: Language not supported
  • v-next/example-project/package.json: Language not supported
  • v-next/hardhat-ethers-chai-matchers/package.json: Language not supported
  • v-next/hardhat-ethers/package.json: Language not supported
  • v-next/hardhat-ignition-ethers/package.json: Language not supported
  • v-next/hardhat-typechain/package.json: Language not supported
  • v-next/hardhat/templates/02-mocha-ethers/package.json: Language not supported
Comments suppressed due to low confidence (2)

v-next/hardhat/test/internal/cli/init/init.ts:283

  • Refine the test skip conditions per the TODO comment to ensure only the intended release PR merge events bypass these tests, thereby avoiding unintended gaps in test coverage.
process.env.GITHUB_EVENT_NAME === "push" || // TODO: This check should be limited to push events associated with a release PR merge

v-next/hardhat-ethers/CHANGELOG.md:3

  • Verify that the version number downgrade in the changelog from '4.0.0-next.2' to '3.0.0-next.2' is intentional and consistent with the overall release strategy.
## 3.0.0-next.2

"@nomicfoundation/template-package",
"template-*"
],
"fixed": [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we ever wanted to stop releasing all the packages together, we could group the ones linked through peer dependency relations here instead.

@github-actions
Copy link
Contributor

hardhat

Total size of the bundle: 245M
Total number of dependencies (including transitive): 111

List of dependencies (sorted by size)
240M	total
29M	@ignored/edr-optimism-linux-x64-musl
29M	@ignored/edr-optimism-linux-x64-gnu
26M	@ignored/edr-optimism-linux-arm64-musl
26M	@ignored/edr-optimism-linux-arm64-gnu
22M	@ignored/edr-optimism-win32-x64-msvc
20M	esbuild
20M	@ignored/edr-optimism-darwin-x64
19M	@ignored/edr-optimism-darwin-arm64
7.4M	@opentelemetry/semantic-conventions
6.0M	@sentry/core
4.0M	@sentry/node
3.1M	@opentelemetry/api
2.5M	micro-eth-signer
2.3M	@opentelemetry/core
1.9M	@opentelemetry/resources
1.9M	@noble/curves
1.7M	undici
1.6M	@opentelemetry/sdk-trace-base
1.2M	@noble/hashes
956K	@opentelemetry/instrumentation
864K	@streamparser/json
864K	@sentry/opentelemetry
860K	@nomicfoundation/hardhat-utils
856K	zod
760K	@opentelemetry/api-logs
676K	import-in-the-middle
624K	resolve
624K	micro-packed
576K	tsx
572K	acorn
544K	fast-equals
492K	@scure/bip39
452K	@nomicfoundation/hardhat-errors
408K	json-stream-stringify
368K	ethereum-cryptography
352K	@ignored/edr
332K	@streamparser/json-node
320K	enquirer
312K	pg-protocol
300K	@opentelemetry/instrumentation-http
288K	semver
280K	@ignored/edr-optimism
224K	@opentelemetry/instrumentation-pg
212K	@opentelemetry/instrumentation-graphql
200K	undici-types
196K	ws
188K	@opentelemetry/instrumentation-mongodb
180K	@opentelemetry/instrumentation-undici
176K	@opentelemetry/instrumentation-express
172K	@opentelemetry/instrumentation-amqplib
168K	@scure/base
164K	cjs-module-lexer
160K	@opentelemetry/instrumentation-fastify
156K	@opentelemetry/instrumentation-hapi
148K	@opentelemetry/instrumentation-redis-4
148K	@opentelemetry/instrumentation-mysql
144K	@opentelemetry/instrumentation-fs
136K	get-tsconfig
136K	adm-zip
136K	@opentelemetry/instrumentation-koa
132K	@opentelemetry/instrumentation-knex
124K	@opentelemetry/instrumentation-mongoose
124K	@opentelemetry/instrumentation-ioredis
120K	@opentelemetry/instrumentation-mysql2
120K	@opentelemetry/instrumentation-connect
116K	@opentelemetry/instrumentation-kafkajs
112K	@opentelemetry/instrumentation-tedious
112K	@opentelemetry/context-async-hooks
96K	@scure/bip32
96K	@opentelemetry/instrumentation-dataloader
92K	chalk
88K	@prisma/instrumentation
80K	@opentelemetry/instrumentation-generic-pool
76K	pg-types
72K	@nomicfoundation/solidity-analyzer
68K	debug
68K	@opentelemetry/sql-common
68K	@opentelemetry/instrumentation-lru-memoizer
64K	@nomicfoundation/hardhat-zod-utils
60K	acorn-import-attributes
60K	@opentelemetry/redis-common
56K	rfdc
56K	is-core-module
56K	function-bind
52K	@types/tedious
48K	shimmer
48K	ansi-colors
44K	resolve.exports
40K	resolve-pkg-maps
40K	require-in-the-middle
40K	forwarded-parse
40K	@types/mysql
36K	supports-preserve-symlinks-flag
36K	p-map
36K	@types/pg
32K	hasown
28K	xtend
24K	strip-ansi
24K	postgres-interval
24K	postgres-array
24K	module-details-from-path
24K	env-paths
24K	ansi-regex
20K	postgres-date
20K	postgres-bytea
20K	pg-int8
20K	path-parse
20K	ms
20K	@types/shimmer
20K	@types/pg-pool
20K	@types/connect

Comment on lines +282 to +285
process.env.HARDHAT_DISABLE_SLOW_TESTS === "true" ||
process.env.GITHUB_EVENT_NAME === "push" || // TODO: This check should be limited to push events associated with a release PR merge
process.env.GITHUB_EVENT_NAME === "merge_group" || // TODO: This check should be limited to merge_group events associated with a release PR merge
process.env.GITHUB_HEAD_REF?.startsWith("changeset-release/"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This check is not ideal. As things stand, these tests would be executed in PRs only. I'll try to come up with a better heuristic.

@galargh galargh changed the title [WIP - not ready for review] ci: automate the v-next release process using changesets ci: automate the v-next release process using changesets May 8, 2025
@galargh galargh added the no changeset needed This PR doesn't require a changeset label May 8, 2025
@galargh galargh marked this pull request as ready for review May 8, 2025 16:22
@galargh galargh closed this May 8, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Hardhat May 8, 2025
@galargh galargh reopened this May 8, 2025
return changesets.length > 0;
}

async function validatePullRequest() {
Copy link
Member

Choose a reason for hiding this comment

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

This is a nit pick, don't change the PR. In this sort of case I would put the validatePullRequest function at the top, to ease reading from top to bottom - while keeping the invocation at the very bottom.

if (line.startsWith('## ')) {
break
}
if (line === '### Patch Changes') {
Copy link
Member

@kanej kanej May 14, 2025

Choose a reason for hiding this comment

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

This line we will need to be careful of when we shift to the full release process for 3.0.0. But the entire process will need reviewed for that.

I will add an issue to indicate we need to review and completely upgrade these scripts for 3.0.0:

#6693

Copy link
Member

@kanej kanej left a comment

Choose a reason for hiding this comment

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

This looks good. I left a few comments, and a suggested improvement to a comment (I would check that my understanding as expressed in the comment is correct).

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
uses: galargh/action-gh-release@571276229e7c9e6ea18f99bad24122a4c3ec813f # https://github.com/galargh/action-gh-release/pull/1
Copy link
Member

Choose a reason for hiding this comment

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

Are we able to push this to Nomic to keep us self-contained?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like we should be able to use the https://github.com/softprops/action-gh-release version of the action instead of my fork now as both my PRs got merged there. I would leave it as a TODO for later though as I would like to carefully check what other things they introduced in their action.

Copy link
Member

Choose a reason for hiding this comment

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

Ah. What is it that drives pulling in an external task here? Is the GitHub API around releases just really cumbersome here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that I think about it, we should be able to use the API directly in our case. This action is great for a little more advanced setups. Especially those where a draft gets updated over and over again. However, in our setup, we only ever create the draft once and that's it.

I'm going to update it to use the GitHub API directly. Thanks for pointing this out. I might not be able to finish it before our meeting though.

Copy link
Member

Choose a reason for hiding this comment

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

Cool lets do that as a follow up PR.
I will mark this as approved.

@github-project-automation github-project-automation bot moved this from Done to In Review in Hardhat May 14, 2025
Copy link
Member

@kanej kanej left a comment

Choose a reason for hiding this comment

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

LGTM!

@kanej kanej added this pull request to the merge queue May 14, 2025
Merged via the queue into v-next with commit 8537dd8 May 14, 2025
84 checks passed
@kanej kanej deleted the v-next-release branch May 14, 2025 15:26
@github-project-automation github-project-automation bot moved this from In Review to Done in Hardhat May 14, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no changeset needed This PR doesn't require a changeset

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants