Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: follow .deb naming conventions #969

Merged
merged 15 commits into from
Jan 12, 2023
Prev Previous commit
Next Next commit
fix version for non-x86
  • Loading branch information
ClementTsang committed Jan 12, 2023
commit 6c729d0b04f809ce87710e02cba6b36e9c4e0cc8
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}' | tr -d \")
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