diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 428ad1fe7..3a7dd6145 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -14,6 +14,12 @@ jobs: runs-on: blacksmith steps: - uses: actions/checkout@v4.2.2 + with: + sparse-checkout: | + .github/workflows/scripts/get_version.sh + .github/workflows/scripts/common.sh + fetch-depth: 1 + fetch-tags: 1 - run: git fetch origin 'refs/tags/*:refs/tags/*' - run: chmod +x ./get_version.sh ./common.sh working-directory: ./.github/workflows/scripts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4df554e32..370a55654 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,12 @@ jobs: runs-on: blacksmith steps: - uses: actions/checkout@v4.2.2 + with: + sparse-checkout: | + .github/workflows/scripts/get_version.sh + .github/workflows/scripts/common.sh + fetch-depth: 1 + fetch-tags: 1 - run: git fetch origin 'refs/tags/*:refs/tags/*' - run: chmod +x ./get_version.sh ./common.sh working-directory: ./.github/workflows/scripts diff --git a/.github/workflows/scripts/common.sh b/.github/workflows/scripts/common.sh index 6711d4940..3e28cbef2 100644 --- a/.github/workflows/scripts/common.sh +++ b/.github/workflows/scripts/common.sh @@ -5,7 +5,7 @@ set -eo pipefail DOCKER_IMAGE_TAG="speckle/speckle-${SPECKLE_SERVER_PACKAGE}" # shellcheck disable=SC2068,SC2046 -LAST_RELEASE="$(git describe --always --tags $(git rev-list --tags) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)" # get the last release tag. FIXME: Fails if a commit is tagged with more than one tag: https://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit/56039163#56039163 +LAST_RELEASE="$(git describe --always --tags $(git rev-list --tags --max-count=1) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)" # get the last release tag. FIXME: Fails if a commit is tagged with more than one tag: https://stackoverflow.com/questions/8089002/git-describe-with-two-tags-on-the-same-commit/56039163#56039163 # shellcheck disable=SC2034 NEXT_RELEASE="$(echo "${LAST_RELEASE}" | awk -F. -v OFS=. '{$NF += 1 ; print}')"