diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 2043b82bb..bd092a640 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -122,16 +122,23 @@ jobs: fi echo "Tag provided: $TAG" - # fetch tags from origin and check - git fetch --tags origin - if git rev-parse --verify --quiet "refs/tags/$TAG" >/dev/null; then + # Check if tag exists locally first (from checkout) + if git rev-parse --verify --quiet "refs/tags/$TAG" 2>/dev/null; then echo "tag_provided=true" >> $GITHUB_OUTPUT echo "tag_exists=true" >> $GITHUB_OUTPUT - echo "Found tag $TAG on repo." + echo "Found tag $TAG locally." else - echo "tag_provided=true" >> $GITHUB_OUTPUT - echo "tag_exists=false" >> $GITHUB_OUTPUT - echo "Tag $TAG not found on repo. Will upload artifacts for manual download." + # Try to fetch the specific tag to avoid case-insensitive filesystem conflicts + echo "Tag not found locally, fetching specific tag from origin..." + if git fetch origin "refs/tags/$TAG:refs/tags/$TAG" 2>/dev/null; then + echo "tag_provided=true" >> $GITHUB_OUTPUT + echo "tag_exists=true" >> $GITHUB_OUTPUT + echo "Found and fetched tag $TAG from repo." + else + echo "tag_provided=true" >> $GITHUB_OUTPUT + echo "tag_exists=false" >> $GITHUB_OUTPUT + echo "Tag $TAG not found on repo. Will upload artifacts for manual download." + fi fi # If tag provided and exists -> attach to release (create/update release by tag) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 94fb6a4b3..f227e06fb 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -93,16 +93,23 @@ jobs: fi echo "Tag provided: $TAG" - # fetch tags from origin and check - git fetch --tags origin - if git rev-parse --verify --quiet "refs/tags/$TAG" >/dev/null; then + # Check if tag exists locally first (from checkout) + if git rev-parse --verify --quiet "refs/tags/$TAG" 2>/dev/null; then echo "tag_provided=true" >> $GITHUB_OUTPUT echo "tag_exists=true" >> $GITHUB_OUTPUT - echo "Found tag $TAG on repo." + echo "Found tag $TAG locally." else - echo "tag_provided=true" >> $GITHUB_OUTPUT - echo "tag_exists=false" >> $GITHUB_OUTPUT - echo "Tag $TAG not found on repo. Will upload artifacts for manual download." + # Try to fetch the specific tag to avoid case-insensitive filesystem conflicts + echo "Tag not found locally, fetching specific tag from origin..." + if git fetch origin "refs/tags/$TAG:refs/tags/$TAG" 2>/dev/null; then + echo "tag_provided=true" >> $GITHUB_OUTPUT + echo "tag_exists=true" >> $GITHUB_OUTPUT + echo "Found and fetched tag $TAG from repo." + else + echo "tag_provided=true" >> $GITHUB_OUTPUT + echo "tag_exists=false" >> $GITHUB_OUTPUT + echo "Tag $TAG not found on repo. Will upload artifacts for manual download." + fi fi # If tag provided and exists -> attach to release (create/update release by tag) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 00b5cb2d9..5ef2d0b15 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -105,16 +105,23 @@ jobs: fi echo "Tag provided: $TAG" - # fetch tags from origin and check - git fetch --tags origin - if git rev-parse --verify --quiet "refs/tags/$TAG" >/dev/null; then + # Check if tag exists locally first (from checkout) + if git rev-parse --verify --quiet "refs/tags/$TAG" 2>/dev/null; then echo "tag_provided=true" >> $GITHUB_OUTPUT echo "tag_exists=true" >> $GITHUB_OUTPUT - echo "Found tag $TAG on repo." + echo "Found tag $TAG locally." else - echo "tag_provided=true" >> $GITHUB_OUTPUT - echo "tag_exists=false" >> $GITHUB_OUTPUT - echo "Tag $TAG not found on repo. Will upload artifacts for manual download." + # Try to fetch the specific tag to avoid case-insensitive filesystem conflicts + echo "Tag not found locally, fetching specific tag from origin..." + if git fetch origin "refs/tags/$TAG:refs/tags/$TAG" 2>/dev/null; then + echo "tag_provided=true" >> $GITHUB_OUTPUT + echo "tag_exists=true" >> $GITHUB_OUTPUT + echo "Found and fetched tag $TAG from repo." + else + echo "tag_provided=true" >> $GITHUB_OUTPUT + echo "tag_exists=false" >> $GITHUB_OUTPUT + echo "Tag $TAG not found on repo. Will upload artifacts for manual download." + fi fi - name: Upload artifacts to GitHub Release (tag exists)