Skip to content

Commit f518885

Browse files
author
Waldek Herka
committed
fix: improve release workflow with prerelease promotion to latest
1 parent 723da94 commit f518885

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
release:
5-
types: [created]
5+
types: [prereleased]
66

77
permissions:
88
contents: write
@@ -64,29 +64,19 @@ jobs:
6464
rpm -qip "$rpm" 2>/dev/null | grep -E "(Name|Version|Release|Architecture|Group)" || \
6565
echo "rpm command not available for detailed info"
6666
done
67-
- name: Create release and upload artifacts
67+
- name: Upload artifacts and set release as latest
6868
env:
6969
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7070
run: |
71-
VERSION="${GITHUB_REF_NAME}"
71+
VERSION="${{ github.event.release.tag_name }}"
7272
73-
# Check if release exists and get its status
74-
RELEASE_INFO=$(gh release view "$VERSION" --json isDraft 2>/dev/null || echo "null")
73+
# Note: the relase is assumed as created as prerelease
74+
# The following section is aimmed at pushing the artifacts to the release
75+
# and promoting it to latest
7576
76-
if [ "$RELEASE_INFO" != "null" ]; then
77-
IS_DRAFT=$(echo "$RELEASE_INFO" | jq -r '.isDraft')
78-
if [ "$IS_DRAFT" = "true" ]; then
79-
echo "Deleting existing draft release $VERSION..."
80-
gh release delete "$VERSION" --yes
81-
else
82-
echo "Release $VERSION already exists and is published. Skipping creation."
83-
exit 0
84-
fi
85-
fi
86-
87-
# Create release with all assets in one command
88-
gh release create "$VERSION" \
89-
--title "🚀 $VERSION" \
90-
--generate-notes \
91-
dist/gh-app-auth-*
77+
echo "Uploading artifacts to release $VERSION..."
78+
gh release upload "$VERSION" dist/gh-app-auth-* --clobber
79+
80+
echo "Setting release as latest..."
81+
gh release edit "$VERSION" --prerelease=false --latest
9282

0 commit comments

Comments
 (0)