mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-28 16:07:05 +00:00
fix: prevent overwriting existing release content in build workflow
This commit is contained in:
@@ -428,6 +428,10 @@ jobs:
|
|||||||
VERSION="${{ steps.release_prep.outputs.version }}"
|
VERSION="${{ steps.release_prep.outputs.version }}"
|
||||||
VERSION_CLEAN="${{ steps.release_prep.outputs.version_clean }}"
|
VERSION_CLEAN="${{ steps.release_prep.outputs.version_clean }}"
|
||||||
|
|
||||||
|
# Check if release already exists
|
||||||
|
if gh release view "$VERSION" >/dev/null 2>&1; then
|
||||||
|
echo "Release $VERSION already exists, skipping creation"
|
||||||
|
else
|
||||||
# Get release notes from tag message
|
# Get release notes from tag message
|
||||||
RELEASE_NOTES=$(git tag -l --format='%(contents)' "${VERSION}")
|
RELEASE_NOTES=$(git tag -l --format='%(contents)' "${VERSION}")
|
||||||
if [[ -z "$RELEASE_NOTES" || "$RELEASE_NOTES" =~ ^[[:space:]]*$ ]]; then
|
if [[ -z "$RELEASE_NOTES" || "$RELEASE_NOTES" =~ ^[[:space:]]*$ ]]; then
|
||||||
@@ -440,11 +444,12 @@ jobs:
|
|||||||
PRERELEASE_FLAG="--prerelease"
|
PRERELEASE_FLAG="--prerelease"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the release
|
# Create the release only if it doesn't exist
|
||||||
gh release create "$VERSION" \
|
gh release create "$VERSION" \
|
||||||
--title "RustFS $VERSION_CLEAN" \
|
--title "RustFS $VERSION_CLEAN" \
|
||||||
--notes "$RELEASE_NOTES" \
|
--notes "$RELEASE_NOTES" \
|
||||||
$PRERELEASE_FLAG
|
$PRERELEASE_FLAG
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Upload release assets
|
- name: Upload release assets
|
||||||
env:
|
env:
|
||||||
@@ -480,7 +485,14 @@ jobs:
|
|||||||
VERSION="${{ steps.release_prep.outputs.version }}"
|
VERSION="${{ steps.release_prep.outputs.version }}"
|
||||||
VERSION_CLEAN="${{ steps.release_prep.outputs.version_clean }}"
|
VERSION_CLEAN="${{ steps.release_prep.outputs.version_clean }}"
|
||||||
|
|
||||||
# Get original release notes
|
# Check if release already has custom notes (not auto-generated)
|
||||||
|
EXISTING_NOTES=$(gh release view "$VERSION" --json body --jq '.body' 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
# Only update if release notes are empty or auto-generated
|
||||||
|
if [[ -z "$EXISTING_NOTES" ]] || [[ "$EXISTING_NOTES" == *"Release ${VERSION_CLEAN}"* ]]; then
|
||||||
|
echo "Updating release notes for $VERSION"
|
||||||
|
|
||||||
|
# Get original release notes from tag
|
||||||
ORIGINAL_NOTES=$(git tag -l --format='%(contents)' "${VERSION}")
|
ORIGINAL_NOTES=$(git tag -l --format='%(contents)' "${VERSION}")
|
||||||
if [[ -z "$ORIGINAL_NOTES" || "$ORIGINAL_NOTES" =~ ^[[:space:]]*$ ]]; then
|
if [[ -z "$ORIGINAL_NOTES" || "$ORIGINAL_NOTES" =~ ^[[:space:]]*$ ]]; then
|
||||||
ORIGINAL_NOTES="Release ${VERSION_CLEAN}"
|
ORIGINAL_NOTES="Release ${VERSION_CLEAN}"
|
||||||
@@ -578,6 +590,9 @@ jobs:
|
|||||||
|
|
||||||
# Update the release with enhanced notes
|
# Update the release with enhanced notes
|
||||||
gh release edit "$VERSION" --notes-file enhanced_notes.md
|
gh release edit "$VERSION" --notes-file enhanced_notes.md
|
||||||
|
else
|
||||||
|
echo "Release $VERSION already has custom notes, skipping update to preserve manual edits"
|
||||||
|
fi
|
||||||
|
|
||||||
# Upload to OSS (optional)
|
# Upload to OSS (optional)
|
||||||
upload-oss:
|
upload-oss:
|
||||||
|
|||||||
Reference in New Issue
Block a user