Skip to content

fix(publish): replace CRAFT_NEW_VERSION with CRAFT_RELEASED_VERSION in post-release env#793

Merged
BYK merged 2 commits intomasterfrom
fix/post-release-env-var-pollution
Apr 17, 2026
Merged

fix(publish): replace CRAFT_NEW_VERSION with CRAFT_RELEASED_VERSION in post-release env#793
BYK merged 2 commits intomasterfrom
fix/post-release-env-var-pollution

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 17, 2026

Summary

  • Fix silent post-release command failure caused by CRAFT_NEW_VERSION env var polluting shared bump-version.sh scripts
  • Replace CRAFT_NEW_VERSION/CRAFT_OLD_VERSION with CRAFT_RELEASED_VERSION in the post-release subprocess environment
  • Positional args kept unchanged for backward compatibility

Root Cause

When craft publish runs the postReleaseCommand, it sets CRAFT_NEW_VERSION=<release-version> in the subprocess env. Repos like self-hosted have a post-release.sh that calls bump-version.sh '' 'nightly', but bump-version.sh reads NEW_VERSION="${CRAFT_NEW_VERSION:-${2:-}}" — the env var takes precedence over the positional arg, so the version gets "bumped" to the already-current release version instead of nightly. No diff → no commit → master stays on the release version.

This caused the self-hosted 26.4.0 publish to succeed without resetting master to nightly.

Fix

Replace CRAFT_NEW_VERSION/CRAFT_OLD_VERSION with CRAFT_RELEASED_VERSION in runPostReleaseCommand(). This lets bump-version.sh fall through to the positional arg (nightly) as intended. The pre-release command (prepare.ts) still correctly uses CRAFT_NEW_VERSION.

…n post-release env

When running the postReleaseCommand, craft set CRAFT_NEW_VERSION to the
just-released version. This polluted shared bump-version scripts that
prefer env vars over positional args — e.g. self-hosted's bump-version.sh
reads NEW_VERSION="${CRAFT_NEW_VERSION:-${2:-}}", so CRAFT_NEW_VERSION
took precedence over the "nightly" positional arg, causing the script to
set the version to the already-current release version. No diff, no
commit, master stays on the release version.

Replace CRAFT_NEW_VERSION/CRAFT_OLD_VERSION with CRAFT_RELEASED_VERSION
in the post-release subprocess environment. The pre-release command
(prepare.ts) still correctly uses CRAFT_NEW_VERSION. Positional args are
kept unchanged for backward compatibility.
@BYK BYK marked this pull request as ready for review April 17, 2026 08:45
@BYK BYK merged commit 6e59f3b into master Apr 17, 2026
18 checks passed
@BYK BYK deleted the fix/post-release-env-var-pollution branch April 17, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant