My Semantic Release Configuration
A basic configuration for Semantic Release when using a single package repository (no monorepo) and NPM or Yarn as package manager without NPM publishing.
Usage
Run:
npm i -DE @ivangabriele/semantic-release-config-no-npm semantic-release
or:
yarn add -DE @ivangabriele/semantic-release-config-no-npm semantic-release
Extend it in your package.json
:
{
// ...
"release": {
"extends": "@ivangabriele/semantic-release-config-no-npm"
}
}
Then add a manually triggered workflow in Github Actions (i.e.: .github\workflows\release.yml
):
name: Release
on: workflow_dispatch
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup
uses: actions/setup-node@v4
with:
cache: yarn
node-version: 20
- name: Install
run: yarn --immutable
- name: Build
run: yarn build
- name: Release
run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get new version
run: echo "NEW_VERSION=$(npm pkg get version | sed 's/"//g')" >> "$GITHUB_ENV"
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
branch: ci-release-v${{ env.NEW_VERSION }}
commit-message: 'ci(release): v${{ env.NEW_VERSION }}'
title: 'ci(release): v${{ env.NEW_VERSION }}'
token: ${{ secrets.GITHUB_TOKEN }}