@adfinis/semantic-release-config

5.0.0 • Public • Published

npm version

@adfinis/semantic-release-config

Sharable configuration for semantic release.

Features

Currently, this config is only a slight modification of the default config:

  • Add @semantic-release/git plugin to publish updated package.json and CHANGELOG.md to repository after deployment

Installation

Install the npm package

yarn add --dev @adfinis/semantic-release-config

and add the following to the extends property of your semantic release configuration:

{
  "extends": "@adfinis/semantic-release-config"
}

This repo also contains commitlint. Configure it to check that commit messagesas are formatted according to the conventional commit format by adding the following: Create the file commitlint.config.js with:

export default { extends: ['@commitlint/config-conventional'] };

Set up a hook to integrate it; e.g. by installing husky:

yarn add husky --dev

then adding the following to package.json:

{
  "scripts": {
    "prepare": "husky"
  }
}

and adding the following script (with execute permissions) to .husky/commit-msg:

# skip in CI
[ -n "$CI" ] && exit 0

# lint commit message
yarn commitlint --edit $1

CI Configuration

  • Add credentials for GitHub and npm as described here
  • Run semantic-release in the deploy stage as described here

Example for a release Github workflow:

name: Release

on: workflow_dispatch

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          persist-credentials: false
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: "yarn"

      - name: Install dependencies
        run: yarn install

      - name: Release on NPM
        run: yarn semantic-release
        env:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Commitizen

Optionally, you can also set up commitizen for a more interactive way of adding commits:

$ git cz

? Select the type of change that you're committing:
? What is the scope of this change (e.g. component or file name)?
? Write a short, imperative tense description of the change:
? Provide a longer description of the change: (press enter to skip)
? Are there any breaking changes? No
? Does this change affect any open issues? No

Setup is simple:

npm install -g commitizen
commitizen init cz-conventional-changelog --yarn --dev --exact

After, run git cz instead of git commit.

Readme

Keywords

none

Package Sidebar

Install

npm i @adfinis/semantic-release-config

Weekly Downloads

98

Version

5.0.0

License

LGPL-3.0-or-later

Unpacked Size

19.2 kB

Total Files

9

Last publish

Collaborators

  • adfinisbot
  • yelinz
  • alanalu
  • velrest
  • czosel
  • anehx