CI: fix handling shallow clone

This commit is contained in:
Benjamin Renard 2024-11-21 01:50:01 +01:00
parent 0eb73ee5bf
commit 5f36a56d48
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -124,6 +124,9 @@ build:debian-stable:
- .cache/pip
only:
- tags
before_script:
# Gitlab CI use shallow clone, but we need full history to generate changelog
- git fetch --unshallow
script:
- ./build-deb.sh --install-build-deps
- rm -fr dist/ldapsaisie-*
@ -140,6 +143,9 @@ build:debian-sid:
- .cache/pip
only:
- master
before_script:
# Gitlab CI use shallow clone, but we need full history to generate changelog
- git fetch --unshallow
script:
- ./build-deb.sh --install-build-deps --sid
- rm -fr dist/ldapsaisie-*
@ -171,11 +177,14 @@ build:doc:html:
- apk add make git
- git config user.name $GITLAB_USER_NAME
- git config user.email $GITLAB_USER_EMAIL
# Compute current version
# Note: Gitlab CI use shallow clone, be sure to have all commits since latest tag
- |
VERSION=$(
git describe --tags 2> /dev/null || \
echo "0.0-$( git log --oneline|wc -l )-$( git describe --tags --always )"
)
git fetch --tags
latest_tag_commit=$(git rev-list --tags --max-count=1)
commit_date=$(git show -s --format="%ad" --date=short $latest_tag_commit)
git fetch --shallow-since=$commit_date
VERSION=$(git describe --tags)
- cd doc
- git fetch origin $DOC_BRANCH
- git rev-parse --verify $DOC_BRANCH && git branch -D $DOC_BRANCH || echo "No existing local git $DOC_BRANCH branch"
@ -240,11 +249,14 @@ build:doc:append_additional_versions:
- apk add git
- git config user.name $GITLAB_USER_NAME
- git config user.email $GITLAB_USER_EMAIL
# Compute current version
# Note: Gitlab CI use shallow clone, be sure to have all commits since latest tag
- |
VERSION=$(
git describe --tags 2> /dev/null || \
echo "0.0-$( git log --oneline|wc -l )-$( git describe --tags --always )"
)
git fetch --tags
latest_tag_commit=$(git rev-list --tags --max-count=1)
commit_date=$(git show -s --format="%ad" --date=short $latest_tag_commit)
git fetch --shallow-since=$commit_date
VERSION=$(git describe --tags)
- cd doc
- git fetch origin $DOC_BRANCH
- git rev-parse --verify $DOC_BRANCH && git branch -D $DOC_BRANCH || echo "No existing local git $DOC_BRANCH branch"