1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

ci: simplify version number

Previously, we used `git describe --tags` to produce a version number
for non-released builds derived from the most recent tag + some info
such as the number of commits since that tag and then `g{HASH}`.

That always confuses people because the date portion at the front
looks old (it is typically the previous release) and the hash at
the end has that `g` in it.

This commit simplifies both the tag name used when making a release
and the computed version number take the date/time from the current
commit, and then append the hash.  That way the version number always
corresponds to a commit.

This scheme doesn't help detect situations where the commit is
dirty, but I don't think the old one would have helped with that
either.
This commit is contained in:
Wez Furlong 2021-04-29 20:23:47 -07:00
parent 94c98aa826
commit 35eb7383b1
6 changed files with 17 additions and 10 deletions

View File

@ -13,8 +13,7 @@ install -Dm644 assets/wezterm.appdata.xml AppDir/usr/share/metainfo/org.wezfurlo
[ -x /tmp/linuxdeploy ] || ( curl -L 'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage' -o /tmp/linuxdeploy && chmod +x /tmp/linuxdeploy )
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
TAG_NAME=${TAG_NAME:-$(git show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S")}
distro=$(lsb_release -is)
distver=$(lsb_release -rs)

View File

@ -4,8 +4,7 @@ set -e
TARGET_DIR=${1:-target}
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
TAG_NAME=${TAG_NAME:-$(git show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S")}
HERE=$(pwd)

View File

@ -3,8 +3,7 @@
set -x
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
TAG_NAME=${TAG_NAME:-$(git show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S")}
if [[ "$BUILD_REASON" == "Schedule" ]] ; then
TAR_NAME=wezterm-nightly-src.tar

View File

@ -1,4 +1,4 @@
#!/bin/bash
TAGNAME=$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)
TAGNAME=$(git show -s "--format=%cd-%h" "--date=format:%Y%m%d-%H%M%S")
git tag $TAGNAME

View File

@ -61,7 +61,12 @@ fn main() {
let head = head.canonicalize().unwrap();
println!("cargo:rerun-if-changed={}", head.display());
if let Ok(output) = std::process::Command::new("git")
.args(&["describe", "--tags", "--match", "20*"])
.args(&[
"show",
"-s",
"--format=%cd-%h",
"--date=format:%Y%m%d-%H%M%S",
])
.output()
{
let info = String::from_utf8_lossy(&output.stdout);

View File

@ -68,12 +68,17 @@ fn main() {
if let Ok(tag) = std::fs::read("../.tag") {
if let Ok(s) = String::from_utf8(tag) {
ci_tag = s.trim().to_string();
println!("cargo:rerun-if-changed=.tag");
println!("cargo:rerun-if-changed=../.tag");
}
}
let version = if ci_tag.is_empty() {
let mut cmd = std::process::Command::new("git");
cmd.args(&["describe", "--tags"]);
cmd.args(&[
"show",
"-s",
"--format=%cd-%h",
"--date=format:%Y%m%d-%H%M%S",
]);
if let Ok(output) = cmd.output() {
if output.status.success() {
String::from_utf8_lossy(&output.stdout).trim().to_owned()