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