diff --git a/.gitea/workflows/linux_arm64_docker.yaml b/.gitea/workflows/linux_arm64_docker.yaml index 75b0cd3..83cc8a2 100644 --- a/.gitea/workflows/linux_arm64_docker.yaml +++ b/.gitea/workflows/linux_arm64_docker.yaml @@ -33,18 +33,16 @@ jobs: git fetch --force --tags origin git fetch --force origin main - LAST_TAG=$(git tag --merged origin/main -l 'v*' --sort=-creatordate | head -n 1) + LAST_TAG=$(git log --first-parent --tags --simplify-by-decoration --pretty='%D' origin/main \ + | grep -oE 'tag: v[^, ]+' \ + | head -n 1 \ + | sed 's/tag: //') - if [[ -z "$LAST_TAG" ]]; then + if [[ -z "${LAST_TAG:-}" ]]; then LAST_TAG="v0.0.1-alpha" - BASE_COMMIT="origin/main" - else - BASE_COMMIT=$(git rev-list -n 1 "${LAST_TAG}") - BASE_COMMIT=$(git rev-parse "${LAST_TAG}") fi - MERGE_BASE=$(git merge-base "${LAST_TAG}" origin/main) - DISTANCE=$(git rev-list --count "${LAST_TAG}..origin/main") + DISTANCE=$(git rev-list --count --first-parent "${LAST_TAG}..origin/main") BASE_VERSION="${LAST_TAG#v}" @@ -59,8 +57,7 @@ jobs: echo "VERSION=$VERSION" >> "$GITHUB_ENV" echo "Last tag: $LAST_TAG" - echo "Merge base: $MERGE_BASE" - echo "Distance to origin/main: $DISTANCE" + echo "Distance to origin/main (first-parent): $DISTANCE" echo "Final version: $VERSION" - name: Set .NET version variables