Skip to content

Commit

Permalink
fix version for non-x86
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Jan 12, 2023
1 parent 0dd019e commit b7a3230
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build_releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,15 @@ jobs:
if: ${{ inputs.caller == 'nightly' }}
id: custom-version
run: |
VERSION=$(./target/${{ matrix.info.target }}/release/btm -V | awk '{print $2}')
echo "CUSTOM_VERSION_ARG='--deb-version=$VERSION'" >> $GITHUB_OUTPUT
if [[ ${{ matrix.info.cross }} == false ]]; then
# x86-64 can be directly executed, so we can do the easy way out.
VERSION=$(./target/${{ matrix.info.target }}/release/btm -V | awk '{print $2}')
echo "CUSTOM_VERSION_ARG='--deb-version=$VERSION'" >> $GITHUB_OUTPUT
else
VER=$(grep -m1 "^version" Cargo.toml | awk '{print $3}')
APPEND=nightly-${GITHUB_SHA::7}
echo "CUSTOM_VERSION_ARG='--deb-version=$VER-$APPEND'" >> $GITHUB_OUTPUT
fi
- name: Build Debian release (x86-64)
if: matrix.info.cross == false
Expand Down
5 changes: 3 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ fn nightly_version() {
{
println!("cargo:rustc-env=NIGHTLY_VERSION={version}-nightly-{git_hash}");
} else if let Ok(output) = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.args(["rev-parse", "HEAD"])
.output()
{
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=NIGHTLY_VERSION={version}-nightly-{git_hash}");
let short_hash = git_hash.get(0..8).unwrap();
println!("cargo:rustc-env=NIGHTLY_VERSION={version}-nightly-{short_hash}");
}
}
_ => {}
Expand Down

0 comments on commit b7a3230

Please sign in to comment.