From a21099013798a812c1124bdbefdc60238eaa139a Mon Sep 17 00:00:00 2001 From: Jack Hall Date: Sat, 12 Sep 2026 12:10:49 -0500 Subject: [PATCH 1/2] ci: automate SemVer releases with semantic-release Add semantic-release config and a release workflow that cuts vX.Y.Z tags and GitHub Releases from Conventional Commits on main, plus PR linting for commit messages and PR titles. Refs: #6 --- .github/workflows/lint.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++++ .releaserc.json | 8 ++++++++ 3 files changed, 74 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..63f1d33 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,31 @@ +name: Lint + +on: + pull_request: + pull_request_target: + types: [opened, synchronize, reopened, edited] + +permissions: + contents: read + pull-requests: read + +jobs: + commitlint: + name: Commit messages + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Lint commits + uses: wagoid/commitlint-github-action@v6 + + pr-title: + name: PR title + if: github.event_name == 'pull_request_target' + runs-on: ubuntu-latest + steps: + - name: Validate PR title + uses: amannn/action-semantic-pull-request@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0a5b301 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + push: + branches: [main] + +permissions: + contents: write + issues: write + pull-requests: write + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Install semantic-release + run: npm install --no-save semantic-release@25 + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..7bf05ec --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,8 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github" + ] +} From cafad99c2b19c420928af3d76913ec61352e9cd9 Mon Sep 17 00:00:00 2001 From: Jack Hall Date: Sat, 12 Sep 2026 12:27:16 -0500 Subject: [PATCH 2/2] ci: align release rules with documented commit mapping Teach the parser the `!` breaking-change shorthand and pin revert commits to no release, so feat!/fix!/BREAKING CHANGE map to major and revert stays inert, matching the mapping in #6. Refs: #6 --- .releaserc.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.releaserc.json b/.releaserc.json index 7bf05ec..c10f569 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,7 +1,17 @@ { "branches": ["main"], "plugins": [ - "@semantic-release/commit-analyzer", + [ + "@semantic-release/commit-analyzer", + { + "parserOpts": { + "breakingHeaderPattern": "^(\\w*)(?:\\((.*)\\))?!: (.*)$" + }, + "releaseRules": [ + { "revert": true, "release": false } + ] + } + ], "@semantic-release/release-notes-generator", "@semantic-release/github" ]