From 3f3d1e1e5df398f71b3e0657455c34b41c9f4bf1 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 8 Mar 2026 23:55:19 +0000 Subject: [PATCH] Ensure all tags are fetched when checking out the repo --- .gitea/workflows/release.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 62d5bbf..a2c2931 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -10,20 +10,19 @@ jobs: runs-on: self-hosted steps: - # 1. Checkout repository - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # fetch full history + tags: true # fetch all tags - # 2. Read VERSION file and check if tag exists - name: Check/Create Tag id: tag run: | VERSION=$(cat VERSION | tr -d '[:space:]') # read version and trim whitespace echo "Version: $VERSION" - # if git rev-parse "v$VERSION" >/dev/null 2>&1; then - tags=$(git tag -l "v$(cat VERSION)" | wc -l) - if [[ $tags == "1" ]]; then + if git rev-parse "v$VERSION" >/dev/null 2>&1; then echo "Tag v$VERSION already exists. Skipping release." exit 0 fi @@ -35,7 +34,6 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT - # 3. Build artifacts (only runs if tag did not exist) - name: Build Artifacts if: steps.tag.outputs.version run: | @@ -43,7 +41,6 @@ jobs: ./package ls -l dist/ - # 4. Create release - name: Create Release if: steps.tag.outputs.version id: create_release @@ -65,7 +62,6 @@ jobs: RELEASE_ID=$(echo $RESPONSE | jq -r '.id') echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT - # 5. Upload artifacts - name: Upload Artifacts if: steps.tag.outputs.version run: | @@ -80,7 +76,6 @@ jobs: "https://git.thewizardapprentice.com/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets?name=$FILENAME" done - # 6. Cleanup artifacts - name: Cleanup if: steps.tag.outputs.version run: rm -rf dist/*