exec icon indicating copy to clipboard operation
exec copied to clipboard

Make semantic-release sync Helm Chart.yaml version with package.json version

Open thedanchez opened this issue 3 years ago • 1 comments

My application has a Helm chart that is used to deploy my app to Kubernetes whenever I do a release. It is located in a subdirectory called deploy in my root project directory.

app/
-- package.json
-- deploy/
---- Chart.yaml (want to sync this with package.json)

Is there a way to have semantic-release update the version field in that file (to be synced with the updated package.json version) as part of its process and also include it as part of the chore(release): x.x.x [skip ci] commit changeset that it generates?

thedanchez avatar May 19 '22 00:05 thedanchez

A bit late, but I solved it as follows:

// .releaserc.js
module.exports = {
  plugins: [
    // ...
    [
      '@semantic-release/exec',
      {
        // WORKAROUND: Use of `case` command, because not all shell versions can interpret the `if` statement syntax correctly
        // Maximum system compatibility between Windows, Linux and MacOS, since `sed -i` behaves differently on each type.
        verifyReleaseCmd:
          "case $OSTYPE in darwin*) SEDOPTION=\" \";; esac && \
           sed -i$SEDOPTION'' -e 's/version:.*/version: ${nextRelease.version}/g' deploy/Chart.yaml && \
           sed -i$SEDOPTION'' -e 's/appVersion:.*/appVersion: \"${nextRelease.version}\"/g' deploy/Chart.yaml",
      },
    ],
  ],
};

SimonGolms avatar Nov 15 '22 12:11 SimonGolms