https://github.com/janszewczyk/semantic-release-config
Semantic-release shareable configuration to publish GitHub projects using GitHub Actions workflows.
https://github.com/janszewczyk/semantic-release-config
conventional-changelog github github-publish npm npm-publish release semantic-release semantic-release-config semantic-release-preset szum-tech
Last synced: about 2 months ago
JSON representation
Semantic-release shareable configuration to publish GitHub projects using GitHub Actions workflows.
- Host: GitHub
- URL: https://github.com/janszewczyk/semantic-release-config
- Owner: JanSzewczyk
- License: mit
- Created: 2023-02-25T19:41:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-09T20:20:20.000Z (3 months ago)
- Last Synced: 2025-03-23T21:35:49.136Z (2 months ago)
- Topics: conventional-changelog, github, github-publish, npm, npm-publish, release, semantic-release, semantic-release-config, semantic-release-preset, szum-tech
- Language: JavaScript
- Homepage:
- Size: 435 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
@szum-tech/semantic-release-config
Semantic-release shareable configuration.
Setting up a Semantic-release configuration should be easier.
Semantic-release shareable configuration to publish GitHub projects using GitHub Actions workflows.---
## 📚 Features
- Uses [Conventional Commits](https://www.conventionalcommits.org/) to generate
[release notes](https://github.com/semantic-release/release-notes-generator),
[changelogs](https://github.com/semantic-release/changelog) and
[determine the version for new releases](https://github.com/semantic-release/commit-analyzer).
- [Creates or updates a CHANGELOG.md file](https://github.com/semantic-release/changelog).
- [Publishes to npm (optional)](https://github.com/semantic-release/npm).
- [Creates a new release on GitHub](https://github.com/semantic-release/github).
- [Updates GitHub issues and PRs that are resolved by a new release](https://github.com/semantic-release/github#successcomment).
- [Commits and pushes the current `version` to `package.json`](https://github.com/semantic-release/git).
- Offers predefined configurations or configuration builder function## 📖 Table of Contents
* [📚 Features](#-features)
* [📖 Table of Contents](#-table-of-contents)
* [🎯 Getting Started](#-getting-started)
* [⚙️ Installation](#-installation)
* [Configuration](#configuration)
* [Predefined configs](#predefined-configs)
* [Configuration Builder](#configuration-builder)
* [💻 Environment Variables Configuration](#-environment-variables-configuration)
* [🚀 Minimal GitHub Release workflow](#-minimal-github-release-workflow)
* [🛠️ Developer Info](#-developer-info)
* [Dependencies](#dependencies)
* [📓 Changelog](#-changelog)
* [📜 License](#-license)## 🎯 Getting Started
### ⚙️ Installation
[@szum-tech/semantic-release-config](https://www.npmjs.com/package/@szum-tech/semantic-release-config) is available as
an [npm package](https://www.npmjs.com/package/@szum-tech/semantic-release-config).```shell
# NPM
npm install --save-dev semantic-release @szum-tech/semantic-release-config# YARN
yarn add -D semantic-release @szum-tech/semantic-release-config# PNPM
pnpm add --save-dev semantic-release @szum-tech/semantic-release-config# BUN
bun add --dev semantic-release @szum-tech/semantic-release-config
```### Configuration
Basic information needed to understand, how to set up semantic-release configuration, you are able to find under
[USAGE > Configuration](https://semantic-release.gitbook.io/semantic-release/usage/configuration) in `semantic-release`
documentation.#### Predefined configs
- `without-npm` - `@szum-tech/semantic-release-config/without-npm` - allows you to perform the code release process,
excluding publishing the code to npm
- `with-npm` - `@szum-tech/semantic-release-config/with-npm` - allows you to perform the code release process, including
publishing the code to npm**Predefined configurations could be set via either:**
- A `.releaserc` file, written in YAML or JSON, with optional extensions: `.yaml`/`.yml`/`.json`/`.js`/`.cjs`/`.mjs`
- A `release.config.(js|cjs|.mjs)` file that exports an object
- A `release` key in the project's `package.json` file**The following examples show how to integrate predefined configuration in project:**
- Via `release.config.mjs` file:
```js
export { default } from "@szum-tech/semantic-release-config/with-npm";
// OR
// export { config } from "@szum-tech/semantic-release-config/without-npm";
// if you don't want to publish your project on npm
```Imported configurations also could be used to extends yours:
```js
/**
* @type {import('semantic-release').GlobalConfig}
*/
export default {
branches: ["master", "next"],
extends: "@szum-tech/semantic-release-config/with-npm"
// OR
// extends: "@szum-tech/semantic-release-config/without-npm";
// if you don't want to publish your project on npm
};
```- Via `release.config.cjs` file:
```js
module.exports = require("@szum-tech/semantic-release-config/with-npm");
// OR
// module.exports = required("@szum-tech/semantic-release-config/without-npm");
// if you don't want to publish your project on npm
```OR extend configuration
```js
/**
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
branches: ["master", "next"],
extends: "@szum-tech/semantic-release-config/with-npm"
// OR
// extends: "@szum-tech/semantic-release-config/without-npm";
// if you don't want to publish your project on npm
};
```- Via `release` key in the project's `package.json` file:
```json
{
"release": {
"extends": "@szum-tech/semantic-release-config/with-npm"
// OR
// "extends": "@szum-tech/semantic-release-config/without-npm";
// if you don't want to publish your project on npm
}
}
```- Via `.releaserc` file:
```json
{
"extends": "@szum-tech/semantic-release-config/with-npm"
// OR
// "extends": "@szum-tech/semantic-release-config/without-npm";
// if you don't want to publish your project on npm
}
```#### Configuration Builder
`@szum-tech/semantic-release-config` also returns the `getConfig` function:
```js
// For *.mjs
import { getConfig } from "@szum-tech/semantic-release-config";// For *.cjs
const { getConfig } = require("@szum-tech/semantic-release-config");
```This function takes an argument `configurationOptions`, where the is located `features` variable - defining configurable
features.**Features Table**
| Name | Description | Type | Default Value |
| :--: | :---------------------------------------: | :-----: | :-----------: |
| npm | Defined if release will be publish on npm | Boolean | false |**The following examples show how to integrate configuration builder function in project:**
- Via `release.config.mjs` file:
```js
import { getConfig } from "@szum-tech/semantic-release-config";export default getConfig({ features: { npmPublish: true } });
```- Via `release.config.cjs` file:
```js
const { getConfig } = require("@szum-tech/semantic-release-config");module.exports = getConfig({ features: { npmPublish: true } });
```## 💻 Environment Variables Configuration
Ensure that your CI configuration has the following environment variables set:
- GITHUB_TOKEN:
[A GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
- NPM_TOKEN: [A npm personal access token](https://www.npmjs.com/package/settings) (**optional** if you don't publish
your project on npm)## 🚀 Minimal GitHub Release workflow
This is the bare minimum required steps to trigger a new release. This will push a new release every time an eligible
commit is pushed to git. Check the opinionated flow to see how to trigger releases manually. Create
`.github/workflows/publish.yml`:```yaml
name: Publish 🚀on:
push:
branches: [main]env:
NODE_VERSION: 22.xjobs:
publish:
name: Publish 🚀
runs-on: ubuntu-latest
steps:
- name: Checkout code 📚
uses: actions/checkout@v4
- name: Set up Node 🟢
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install packages ⚙️
run: npm ci
- name: Build 🏗️
run: npm run build
- name: Publish package 🚀
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```> [!TIP]
> See also [publish.yml](https://github.com/JanSzewczyk/semantic-release-config/blob/main/.github/workflows/publish.yml) file.## 🛠️ Developer Info
### Dependencies






## 📓 Changelog
The [changelog](https://github.com/JanSzewczyk/semantic-release-config/blob/main/CHANGELOG.md) is regularly updated to
reflect what's changed in each new release.## 📜 License
This project is licensed under the terms of the
[MIT license](https://github.com/JanSzewczyk/semantic-release-config/blob/main/LICENSE).