From 753f2eeab8ce8b3d7b15f8f8b73cdf9072c6d03d Mon Sep 17 00:00:00 2001 From: Joris Buchou Date: Wed, 22 Apr 2026 16:39:16 -0700 Subject: [PATCH 1/3] feat: add semantic-release with conventional commits --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ .releaserc.yaml | 24 ++++++++++++++++++++++++ README.md | 10 ++++++++++ RELEASE.md | 14 ++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.yaml create mode 100644 RELEASE.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c14762e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + branches: + - main + - rc/* + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: cycjimmy/semantic-release-action@v6.0.0 + with: + extra_plugins: | + conventional-changelog-conventionalcommits + @semantic-release/exec + env: + FORCE_COLOR: 1 + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..71761c5 --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,24 @@ +plugins: + - - '@semantic-release/commit-analyzer' + - preset: 'conventionalcommits' + - - '@semantic-release/release-notes-generator' + - preset: 'conventionalcommits' + - - '@semantic-release/github' + - successCommentCondition: false + + # Update dist, in case Dependabot PRs merged without doing so + - - '@semantic-release/exec' + - prepareCmd: 'pnpm install && pnpm run build' + + - - '@semantic-release/git' + - assets: + - 'dist/**' + - 'package.json' # commit updated version back to source + message: 'chore(release): update dist and package.json' + + - '@semantic-release/npm' + +branches: + - main + - name: rc/* + prerelease: '${name.replace(/^rc\//, "rc-")}' diff --git a/README.md b/README.md index a9523df..d3af874 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # parser-js One that parses + +## Release + +To trigger a release in this project, merge a commit to `main` prefixed with: + +1. `fix:` to trigger a patch release, +1. `feat:` to trigger minor, or +1. Use `!:` or the `BREAKING CHANGES: ` footer to trigger major + +See [RELEASE.md](./RELEASE.md) for more details. diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..e1b9e5d --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,14 @@ +# Release + +This project uses [semantic-release](https://github.com/semantic-release/semantic-release) +with [conventional commits](https://www.conventionalcommits.org/) to trigger releases. + +To trigger a release in this project, merge a commit to `main` prefixed with: + +1. `fix:` to trigger a patch release, +1. `feat:` to trigger minor, or +1. Use `!:` or the `BREAKING CHANGES: ` footer to trigger major + +Pre-releases can be made by pushing to an `rc/*` branch. + +For more details, see the [Semantic Release](https://illuminate.atlassian.net/wiki/spaces/PENG/pages/17952735277/Semantic+Release) documentation. From c3b7457a3ad93467e1f099189c025eba16568ff6 Mon Sep 17 00:00:00 2001 From: Joris Buchou Date: Thu, 23 Apr 2026 08:08:36 -0700 Subject: [PATCH 2/3] fix: simplify README release section and fix RELEASE.md numbering --- README.md | 8 +------- RELEASE.md | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d3af874..9029449 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,4 @@ One that parses ## Release -To trigger a release in this project, merge a commit to `main` prefixed with: - -1. `fix:` to trigger a patch release, -1. `feat:` to trigger minor, or -1. Use `!:` or the `BREAKING CHANGES: ` footer to trigger major - -See [RELEASE.md](./RELEASE.md) for more details. +See [RELEASE.md](./RELEASE.md). diff --git a/RELEASE.md b/RELEASE.md index e1b9e5d..84f04e6 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -6,8 +6,8 @@ with [conventional commits](https://www.conventionalcommits.org/) to trigger rel To trigger a release in this project, merge a commit to `main` prefixed with: 1. `fix:` to trigger a patch release, -1. `feat:` to trigger minor, or -1. Use `!:` or the `BREAKING CHANGES: ` footer to trigger major +2. `feat:` to trigger minor, or +3. Use `!:` or the `BREAKING CHANGES: ` footer to trigger major Pre-releases can be made by pushing to an `rc/*` branch. From 4318c0d39dfe18928c724137d62891a273cca674 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Thu, 20 Aug 2026 15:54:35 -0600 Subject: [PATCH 3/3] fix: address review feedback on release automation - set up pnpm and node via pnpm/action-setup and actions/setup-node before invoking semantic-release, since the release job otherwise has no pnpm on PATH to run the build - drop the @semantic-release/git step; dist and package.json are no longer committed back to main, since npm packs whatever the build produces on disk via the new "files" allowlist below (avoids the ordering question between the git and npm plugins, and the token/ ruleset question for pushing back to a protected branch) - add "files": ["dist"] to package.json so npm publishes only the built output, matching freckle/cancelable-promise-js --- .github/workflows/release.yml | 6 +++++- .releaserc.yaml | 9 ++------- package.json | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c14762e..130e6ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,11 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + - uses: pnpm/action-setup@v6 + - uses: actions/setup-node@v7 + with: + cache: pnpm - uses: cycjimmy/semantic-release-action@v6.0.0 with: extra_plugins: | diff --git a/.releaserc.yaml b/.releaserc.yaml index 71761c5..01aff92 100644 --- a/.releaserc.yaml +++ b/.releaserc.yaml @@ -6,16 +6,11 @@ plugins: - - '@semantic-release/github' - successCommentCondition: false - # Update dist, in case Dependabot PRs merged without doing so + # Build dist fresh for each release; not committed back to the repo + # (npm packs whatever is on disk via the "files" allowlist in package.json) - - '@semantic-release/exec' - prepareCmd: 'pnpm install && pnpm run build' - - - '@semantic-release/git' - - assets: - - 'dist/**' - - 'package.json' # commit updated version back to source - message: 'chore(release): update dist and package.json' - - '@semantic-release/npm' branches: diff --git a/package.json b/package.json index 4d8a1a9..c8098e6 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "type": "module", "description": "One that parses", "main": "./dist/index.js", + "files": [ + "dist" + ], "repository": "https://github.com/freckle/parser-js.git", "author": "Freckle", "license": "MIT",