Newer
Older
A `semantic-release` plugin to update JSON, YAML, TOML and more files with [`yq`].
| Step | Description |
| ---- | ----------- |
| verifyConditions | Verify that each file is writable and the `yq` expression is valid. |
| prepare | Updates each file in-place with the `yq` expression provided. |
```sh
npm config --location project set registry https://gitlab.arm.com/api/v4/groups/semantic-release/-/packages/npm/
npm install --save-dev @semantic-release/yq
```yaml
plugins:
- path: "@semantic-release/yq"
assets:
- filepath: "some/file.yaml"
expression: |-
.version = "${nextRelease.version}"
```
The most common usage is to bump a version in a JSON, YAML or TOML file:
```yaml
plugins:
- path: "@semantic-release/yq"
assets:
- filepath: "some/file.yaml"
expression: |-
.version = "${nextRelease.version}"
```
At least _one_ file must be provided to the plugin configuration.
```yaml
plugins:
- path: "@semantic-release/yq"
assets:
- filepath: "./some/file.yaml"
expression: ".a = .b"
```
```yaml
plugins:
- path: "@semantic-release/yq"
assets:
- filepath: "./some/some.yaml"
expression: ".a = .b"
```
The `yq` [expression][quick-usage-guide] to execute on the provided file.
Can use [lodash template] `semantic-release` [substitutions].
```yaml
plugins:
- path: "@semantic-release/yq"
assets:
- filepath: "./some/file.yaml"
expression: |-
.version = "${nextRelease.version}"
```
[yq]: https://github.com/mikefarah/yq
[quick-usage-guide]: https://github.com/mikefarah/yq?tab=readme-ov-file#quick-usage-guide
[lodash template]: https://docs-lodash.com/v4/template/
[substitutions]: https://semantic-release.gitbook.io/semantic-release/developer-guide/js-api#nextrelease