ci: add release-please and conventional commit enforcement#1467
Open
ci: add release-please and conventional commit enforcement#1467
Conversation
Imports version directly from package.json so release-please can manage it from a single source of truth. Switches jest transform from ts-jest to babel-jest for all files to support import attributes, and removes the now-unused ts-jest dependency.
Automates version bumps, changelog generation, and GitHub releases via release-please. The existing release.yml workflow handles npm publishing when a release is created.
Contributor
Greptile OverviewGreptile SummaryAutomated release management by integrating release-please to handle version bumps, changelog generation, and GitHub releases based on conventional commits. Key Changes:
Release Flow:
The version in User-Agent headers will automatically reflect the current package version without manual updates. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Git as Git (main branch)
participant RP as Release Please Action
participant GH as GitHub Release
participant NPM as NPM Registry
Dev->>Git: Push commit with conventional commit message<br/>(feat:, fix:, chore:, etc.)
Git->>RP: Trigger release-please workflow
RP->>RP: Parse commits since last release
RP->>RP: Calculate new version number
RP->>RP: Generate/update CHANGELOG.md
RP->>Git: Create or update Release PR<br/>(version bump in package.json)
Dev->>Git: Review and merge Release PR
Git->>RP: Trigger release-please on merge
RP->>GH: Create GitHub Release with tag
GH->>NPM: Trigger release.yml workflow
NPM->>NPM: Install dependencies
NPM->>NPM: Run build (tsdown)
NPM->>NPM: Run tests
NPM->>NPM: Publish to npm registry
Note over Dev,NPM: VERSION in User-Agent derived from package.json<br/>automatically reflects new version
|
This option only applies to 0.x versions. At 8.x, breaking changes already bump major by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
package.jsoninstead of a hardcodedVERSIONconstant insrc/workos.ts. This is required so release-please can bump the version in a single place (package.json) and have it propagate to the User-Agent header automatically.release-please-config.json,.release-please-manifest.json,.github/workflows/release-please.yml) to automate version bumps, changelog generation, and GitHub Release creation via conventional commits..github/workflows/lint-pr-title.yml) to enforce conventional commit format on PR titles. Since PRs are squash-merged, the PR title becomes the commit message that release-please parses. This check runs on all PRs after this one merges. Consider adding it as a required status check in branch protection formain.ts-jestwith the existingbabel-jesttransformer injest.config.cjs. Theimport ... with { type: 'json' }syntax used for the package.json import is incompatible withts-jest(which overridesmoduleto"commonjs"). The project's existingjest-transform-esm.cjs(babel-jest +@babel/preset-typescript) handles this correctly.ts-jestis removed fromdevDependenciesas it is no longer used anywhere.How it works
feat:,fix:,chore:, etc.) are enforced on PR titles viaamannn/action-semantic-pull-requestmainrelease-please-actionopens (or updates) a release PR with a version bump andCHANGELOG.mdentryrelease.ymlworkflow triggers on therelease: [published]event and publishes to npmNo changes to the existing publish workflow are needed — it already triggers on GitHub Release events.
Files changed
src/workos.tsVERSIONfrompackage.jsoninstead of hardcodingjest.config.cjsjest-transform-esm.cjsfor both.tsand.jspackage.jsonts-jestfrom devDependenciespackage-lock.jsonts-jestand its dependency treerelease-please-config.json.release-please-manifest.json8.2.0.github/workflows/release-please.ymlmain.github/workflows/lint-pr-title.yml