Kaynağa Gözat

fix: streamline release creation process in cache save action

TheWildJames 3 ay önce
ebeveyn
işleme
9e46c34475
1 değiştirilmiş dosya ile 10 ekleme ve 16 silme
  1. 10 16
      .github/actions/cache-save/action.yml

+ 10 - 16
.github/actions/cache-save/action.yml

@@ -78,33 +78,27 @@ runs:
         # Git configuration for releases
         git config user.name "github-actions[bot]"
         git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+        TARGET_COMMIT=$(git rev-parse HEAD)
         
         # Helper function to handle release creation
         ensure_release() {
           local tag_name="$1"
           
-          git fetch --tags --force
-          
           if gh release view "$tag_name" --repo "$TARGET_REPO" >/dev/null 2>&1; then
             echo "Release '$tag_name' already exists. Ready for upload."
             gh release edit "$tag_name" --latest=false --repo "$TARGET_REPO" >/dev/null 2>&1 || true
             return 0
           fi
 
-          if ! git rev-parse "$tag_name" >/dev/null 2>&1; then
-            echo "Tag '$tag_name' not found. Creating backdated tag and release..."
-            GIT_COMMITTER_DATE="2015-01-01T12:00:00" git tag -a "$tag_name" -m "Build Cache Storage"
-            if git push origin "$tag_name" --force; then
-              gh release create "$tag_name" --title "Build Cache" --notes "Automated storage for build assets" --latest=false --repo "$TARGET_REPO" || true
-              gh release edit "$tag_name" --latest=false --repo "$TARGET_REPO" >/dev/null 2>&1 || true
-            else
-              echo "Push failed, tag might have been created by a parallel job. Continuing..."
-            fi
-          else
-            echo "Tag '$tag_name' already exists but release is missing. Creating release..."
-            gh release create "$tag_name" --title "Build Cache" --notes "Automated storage for build assets" --latest=false --repo "$TARGET_REPO" || true
-            gh release edit "$tag_name" --latest=false --repo "$TARGET_REPO" >/dev/null 2>&1 || true
-          fi
+          echo "Tag '$tag_name' not found or release is missing. Creating release..."
+          gh release create "$tag_name" \
+            --target "$TARGET_COMMIT" \
+            --title "Build Cache" \
+            --notes "Automated storage for build assets" \
+            --latest=false \
+            --repo "$TARGET_REPO" || true
+          gh release edit "$tag_name" --latest=false --repo "$TARGET_REPO" >/dev/null 2>&1 || true
         }
         
         upload_with_retry() {