Skip to content

[release] Allow build version to be injected at compile time - #48436

Merged
clintjedwards merged 1 commit into
mainfrom
cje/build_version_envvar
Sep 17, 2026
Merged

clintjedwards merged 1 commit into
mainfrom
cje/build_version_envvar

Conversation

@clintjedwards

Copy link
Copy Markdown
Contributor

This adds a new build envvar that will overwrite the default CARGO_PKG_VERSION and removes some of the logic we were using to generate unique build versions for dev versions.

In short:

  • We introduce a new PUSHPIN_BUILD_VERSION environment variable (prefixed to not collide with CI env vars) that we use whenever we want to overwrite the build version listed in cargo.toml.
  • Building the normal way (cargo build --release) without any extra envvars still uses the version in cargo.toml as the version.
  • This allows us some flexibility when building final assets as to what the version string actually gets set as. Very useful when hotfixing, for downstream forks, or just generally doing things that need the version string to change but don't want cargo.toml to be updated. (Things like appending the date to the build version and such)
  • This PR also cleans up the -dev logic for appending dates since we're moving away from explicitly tagging out of band release builds with a -dev suffix.
    • The env var addition actually becomes a mechanism where we can reinstate this behavior if wanted to. For example, explicitly setting the env var would set the version string as normal, but not setting it could append some identifier like -dev or -rc or whatever (Or vice-versa).

@clintjedwards
clintjedwards requested a review from a team September 17, 2026 02:06
@clintjedwards
clintjedwards force-pushed the cje/build_version_envvar branch from a1916aa to 2e7d1d6 Compare September 17, 2026 02:09
This adds a new build envvar that will overwrite the default `CARGO_PKG_VERSION`
and removes some of the logic we were using to generate unique build versions
for dev versions.

In short:

* We introduce a new `PUSHPIN_BUILD_VERSION` environment variable (prefixed
to not collide with CI env vars) that we use whenever we want to overwrite
the build version listed in `cargo.toml`.
* Building the normal way (`cargo build --release`) without any extra envvars
still uses the version in `cargo.toml` as the version.
* This allows us some flexibility when building final assets as to what the
version string actually gets set as. Very useful when hotfixing, for downstream
forks, or just generally doing things that need the version string to change but don't want `cargo.toml`
to be updated. (Things like appending the date to the build version and such)
* This PR also cleans up the `-dev` logic for appending dates since we're moving away
from explicitly tagging out of band release builds with a `-dev` suffix.
@clintjedwards
clintjedwards force-pushed the cje/build_version_envvar branch from 2e7d1d6 to 2a200d8 Compare September 17, 2026 02:55
@clintjedwards
clintjedwards merged commit 2a200d8 into main Sep 17, 2026
21 checks passed
@clintjedwards
clintjedwards deleted the cje/build_version_envvar branch September 17, 2026 22:09
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.

3 participants