From e6f705486d831691a71e271a17e5aef8c38fce88 Mon Sep 17 00:00:00 2001 From: Ducky SSH User Date: Sat, 20 Dec 2025 06:24:56 +0000 Subject: [PATCH] Fix git tag checkout in Gitea Actions workflow - For tags: fetch with explicit ref mapping to refs/tags/ - For branches: fetch with explicit ref mapping to refs/remotes/origin/ - Properly checkout tag refs using refs/tags/ path - Fixes 'pathspec did not match any file(s)' error on tag builds --- .gitea/workflows/release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 7e76784..b64a408 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -17,10 +17,14 @@ jobs: cd $GITHUB_WORKSPACE git init git remote add origin ${{ github.server_url }}/${{ github.repository }}.git - git fetch origin ${{ github.ref }} + if [[ "${{ github.ref }}" == refs/tags/* ]]; then - git checkout ${{ github.ref_name }} + # For tags, fetch the specific tag and checkout the commit it points to + git fetch origin ${{ github.ref }}:refs/tags/${{ github.ref_name }} + git checkout refs/tags/${{ github.ref_name }} else + # For branches, fetch and checkout with tracking + git fetch origin ${{ github.ref_name }}:refs/remotes/origin/${{ github.ref_name }} git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} fi