Skip to content

support replacements in external files during merge #34

@miniscruff

Description

@miniscruff

Updating the changelog file acts as the point of "this is a now a new version" but many projects have version fields in other places that should update at the same time. Some examples are package.json for javascript, setup.py for python packages, sphinx packages have a version value, etc. Goreleaser allows using ldflags as build parameters which can be injected from changie latest.

Configuration:

replacements:
- path: file/path.ext
  find: '  "version": ".*",' # regex search each line in file
  replace: '  "version": "{{.VersionNoPrefix}}",' # go template line replacement

For a javascript package.json:

{
  "name": "test-project",
  "version": "1.0.0",
  "description": "changie project",
  "main": "src/main.js",
}

Replace Struct:

type ReplaceData struct {
    Version string  // original version
    VersionNoPrefix string // no v prefix if version had it
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions