mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-19 19:25:41 +02:00
generate-version: handle git repo not having any tags
This commit is contained in:
parent
6250360c58
commit
9a1371b96a
2 changed files with 8 additions and 6 deletions
|
@ -1,8 +1,3 @@
|
||||||
clone:
|
|
||||||
git:
|
|
||||||
image: plugins/git
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
codespell:
|
codespell:
|
||||||
when: { branch: master }
|
when: { branch: master }
|
||||||
|
|
|
@ -13,7 +13,14 @@ out_file=${3}
|
||||||
if [ -d "${src_dir}/.git" ] && command -v git > /dev/null; then
|
if [ -d "${src_dir}/.git" ] && command -v git > /dev/null; then
|
||||||
workdir=$(pwd)
|
workdir=$(pwd)
|
||||||
cd "${src_dir}"
|
cd "${src_dir}"
|
||||||
|
|
||||||
|
if git describe --tags > /dev/null 2>&1; then
|
||||||
git_version=$(git describe --always --tags)
|
git_version=$(git describe --always --tags)
|
||||||
|
else
|
||||||
|
# No tags available, happens in e.g. CI builds
|
||||||
|
git_version="${default_version}"
|
||||||
|
fi
|
||||||
|
|
||||||
git_branch=$(git rev-parse --abbrev-ref HEAD)
|
git_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
cd "${workdir}"
|
cd "${workdir}"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue