Skip to content

Helm chart version bump should honor pre release mode #384

Closed

Description

@chiragjn

What happened?

When we are in changeset pre mode (rc tag), merging the Versioning Packages (rc) PR will version the trueforge package correctly but the helm chart always gets a non rc bump

For e.g. when we released 0.1.4-rc.0 it resulted in chart 0.1.4
#347

We would have liked to release chart version 0.1.4-rc.0

Note: Our goal is not to keep the npm package version and chart version in sync, chart version can independently be ahead. Our goal is to only respect the rc mode

So for e.g.

package: 0.1.5-rc.X
chart: 0.1.6-rc.Y

is valid


Code changes will be mostly limited to

set -euo pipefail
SEMVER='^([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z.-]+)?$'
CURRENT=$(yq -r '.version' charts/trueforge/Chart.yaml)
if [[ ! "$CURRENT" =~ $SEMVER ]]; then
echo "Chart.yaml version '$CURRENT' on $GITHUB_REF_NAME is not semver" >&2
exit 1
fi
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
# create-pull-request rebuilds the PR branch from base plus this
# workspace, so a reviewer's major/minor bump on the open PR is dropped
# unless it is re-applied here. Only outrank the patch bump: a PR
# version at or below it means base already absorbed that release.
if git ls-remote --exit-code --heads origin "$PR_BRANCH" >/dev/null 2>&1; then
git fetch --depth=1 origin "$PR_BRANCH"
PR_VERSION=$(git show FETCH_HEAD:charts/trueforge/Chart.yaml | yq -r '.version')
if [[ "$PR_VERSION" =~ $SEMVER ]] &&
(( BASH_REMATCH[1] > MAJOR ||
(BASH_REMATCH[1] == MAJOR && BASH_REMATCH[2] > MINOR) ||
(BASH_REMATCH[1] == MAJOR && BASH_REMATCH[2] == MINOR && BASH_REMATCH[3] > PATCH + 1) )); then
echo "Keeping chart version $PR_VERSION from $PR_BRANCH (over $VERSION)"
VERSION="$PR_VERSION"
fi
fi
export VERSION IMAGE_TAG APP_VERSION
yq -i '.version = strenv(VERSION)' charts/trueforge/Chart.yaml
yq -i '.image.tag = strenv(IMAGE_TAG)' charts/trueforge/values.yaml
if [[ "$UPDATE_APP_VERSION" == "true" ]]; then
yq -i '.appVersion = strenv(APP_VERSION)' charts/trueforge/Chart.yaml
fi
APP_VERSION=$(yq -r '.appVersion' charts/trueforge/Chart.yaml)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"

Steps to reproduce

This is tricky to reproduce for community without modifying the workflow to skip the build and push image step

Once that step is skipped with dummy image tag output - trigger the workflow with something like app_version 0.1.5-rc.0.

How are you running TrueForge?

N/A

Version

N/A

Relevant logs or screenshots

Environment

No response

Activity

  1. changed the title [-]Helm chart version bump should take into account rc releases[/-] [+]Helm chart version bump should honor `pre` release mode[/+] on Aug 21, 2026
  2. added
    help wantedMaintainers will accept community code contributions for this issue
    on Aug 21, 2026
  3. jayesh9747 commented on Aug 21, 2026

    @jayesh9747
    Contributor

    @chiragjn i want to pickup this issue also. can i start to work on that ?

  4. jayesh9747 commented on Aug 21, 2026

    @jayesh9747
    Contributor

    RCA for the above bug is : Changesets correctly passes the RC version (for example, 0.1.4-rc.0) to the chart-release workflow. The issue is in the chart version calculation—it only uses the current chart’s major/minor/patch and always generates the next stable patch, so the RC suffix is ignored.
    The fix should preserve the chart’s independent numeric versioning while carrying over the prerelease mode from app_version. For example, chart 0.1.5 with app 0.1.5-rc.2 should produce chart 0.1.6-rc.2. We should also update the open chart-PR comparison to consider prerelease suffixes when the numeric versions are equal. Tests should cover stable, first RC, and existing RC PR cases.

  5. chiragjn commented on Aug 21, 2026

    @chiragjn
    MemberAuthor

    @jayesh9747 I see you have already begun work, so assigning it you. Just one comment in the approach

    chart 0.1.5 with app 0.1.5-rc.2 should produce chart 0.1.6-rc.2.

    Hmm, workable, but I would expect algorithm to be like

    0.1.5 --> pre mode --> 0.1.6-rc.N --> 0.1.6-rc.(N + 1) --> exit pre --> 0.1.6 --> 0.1.7

    basically the chart's rc move linearly without caring about app version's rc part

  6. jayesh9747 commented on Aug 23, 2026

    @jayesh9747
    Contributor

    @chiragjn Thanks for the suggestion. I’ve updated PR #394 accordingly.

    The chart RC version now moves independently of the app’s RC number:

    0.1.5 → 0.1.6-rc.0 → 0.1.6-rc.1 → 0.1.6 → 0.1.7

    The app version is now only used to determine whether we are in prerelease mode. I’ve also added tests for this flow. Please take a look when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workinghelp wantedMaintainers will accept community code contributions for this issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions