https://github.com/jpoehnelt/semantic-release-replace-plugin
A semantic-release plugin for replacing text in files with the current release version.
https://github.com/jpoehnelt/semantic-release-replace-plugin
semantic-release semantic-release-plugin
Last synced: 25 days ago
JSON representation
A semantic-release plugin for replacing text in files with the current release version.
- Host: GitHub
- URL: https://github.com/jpoehnelt/semantic-release-replace-plugin
- Owner: jpoehnelt
- License: apache-2.0
- Created: 2020-03-30T22:29:00.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T15:24:15.000Z (about 1 year ago)
- Last Synced: 2025-03-29T11:08:54.955Z (about 1 month ago)
- Topics: semantic-release, semantic-release-plugin
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/semantic-release-replace-plugin
- Size: 1020 KB
- Stars: 115
- Watchers: 3
- Forks: 12
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - jpoehnelt/semantic-release-replace-plugin - A semantic-release plugin for replacing text in files with the current release version. (TypeScript)
README
# Semantic Release Replace Plugin
[](https://www.npmjs.com/package/semantic-release-replace-plugin)


[](https://codecov.io/gh/jpoehnelt/semantic-release-replace-plugin)

[](https://github.com/semantic-release/semantic-release)The `semantic-release-replace-plugin` plugin provides functionality to update version strings throughout a project. This enables semantic release to be used in many different languages and build processes.
Read more about [Semantic Release](https://semantic-release.gitbook.io/).
## Install
```bash
$ npm install semantic-release-replace-plugin -D
```## Usage
The following example uses this plugin to demonstrate using semantic-release in a Python package where `__VERSION__` is defined in the root `__init__.py` file.
```json
{
"plugins": [
"@semantic-release/commit-analyzer",
[
"semantic-release-replace-plugin",
{
"replacements": [
{
"files": ["foo/__init__.py"],
"from": "__VERSION__ = \".*\"",
"to": "__VERSION__ = \"${nextRelease.version}\"",
"results": [
{
"file": "foo/__init__.py",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
}
]
}
],
[
"@semantic-release/git",
{
"assets": ["foo/*.py"]
}
]
]
}
```
### ValidationThe presence of the `results` array will trigger validation that a replacement has been made. This is optional but recommended.
### Warning
This plugin will not commit changes unless you specify assets for the @semantic-release/git plugin! This is highlighted below.
```
[
"@semantic-release/git",
{
"assets": ["foo/*.py"]
}
]
```## Options
Please refer to the [documentation](./docs/README.md) for more options.