From 89fb5bbf7de91f42bbf5b6ce26670b87cdadc2b1 Mon Sep 17 00:00:00 2001 From: Ducky SSH User Date: Sat, 20 Dec 2025 06:09:43 +0000 Subject: [PATCH] Fix git checkout for tag builds in Gitea Actions - Add conditional logic to handle tag vs branch checkouts - Tags don't exist on 'origin/tagname' so use direct checkout - Branches can be checked out as 'origin/branchname' - Fixes 'fatal: origin/v0.0.1 is not a commit' error --- .gitea/workflows/release.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 2588dbe..8c214e4 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -18,7 +18,11 @@ jobs: git init git remote add origin ${{ github.server_url }}/${{ github.repository }}.git git fetch origin ${{ github.ref }} - git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + git checkout ${{ github.ref_name }} + else + git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} + fi - name: Set up Go run: | @@ -31,7 +35,7 @@ jobs: id: version run: | if [[ "${{ github.ref }}" == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} + VERSION=${{ github.ref_name }} else VERSION=dev-${{ github.sha }} fi @@ -148,7 +152,11 @@ jobs: git init git remote add origin ${{ github.server_url }}/${{ github.repository }}.git git fetch origin ${{ github.ref }} - git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + git checkout ${{ github.ref_name }} + else + git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }} + fi - name: Set up Docker run: |