From 3a1c353ea30a66bb798909433425875988714f85 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sat, 24 Feb 2024 21:37:56 +0100 Subject: [PATCH] Use git tag as version identifier in package scripts --- .github/scripts/.package.zsh | 10 +++++++++- .github/scripts/Package-Windows.ps1 | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/scripts/.package.zsh b/.github/scripts/.package.zsh index 01edef885..1ea218632 100755 --- a/.github/scripts/.package.zsh +++ b/.github/scripts/.package.zsh @@ -163,9 +163,13 @@ ${_usage_host:-}" local product_name local product_version + local git_tag="$(git describe --tags)" read -r product_name product_version <<< \ "$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})" + log_info "Using git tag as version identifier '${git_tag}'" + product_version="${git_tag}" + if [[ ${host_os} == macos ]] { autoload -Uz check_packages read_codesign read_codesign_installer read_codesign_pass @@ -247,15 +251,19 @@ ${_usage_host:-}" cmake --build build_${target##*-} --config ${config} -t package_source ${cmake_args} popd + local output_name="${product_name}-${product_version}-${target##*-}-linux-gnu" + if (( package )) { log_group "Packaging ${product_name}..." pushd ${project_root} cmake --build build_${target##*-} --config ${config} -t package ${cmake_args} + + mv ${project_root}/release/*.deb ${project_root}/release/${output_name}.deb + mv ${project_root}/release/*.ddeb ${project_root}/release/${output_name}.ddeb popd } log_group "Archiving ${product_name}..." - local output_name="${product_name}-${product_version}-${target##*-}-linux-gnu" local _tarflags='cJf' if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}" diff --git a/.github/scripts/Package-Windows.ps1 b/.github/scripts/Package-Windows.ps1 index 67b02093d..4823136d9 100644 --- a/.github/scripts/Package-Windows.ps1 +++ b/.github/scripts/Package-Windows.ps1 @@ -48,6 +48,10 @@ function Package { $ProductName = $BuildSpec.name $ProductVersion = $BuildSpec.version + $GitOutput = git describe --tags + Log-Information "Using git tag as version identifier '${GitOutput}'" + $ProductVersion = $GitOutput + $OutputName = "${ProductName}-${ProductVersion}-windows-${Target}" if ( ! $SkipDeps ) {