Dynamically mark releases as prerelease based on tag name
This commit is contained in:
@@ -40,11 +40,16 @@ jobs:
|
|||||||
TOKEN="${{ github.token }}"
|
TOKEN="${{ github.token }}"
|
||||||
TAG="${{ github.ref_name }}"
|
TAG="${{ github.ref_name }}"
|
||||||
|
|
||||||
|
IS_PRERELEASE="false"
|
||||||
|
if [[ "$TAG" == *"beta"* ]] || [[ "$TAG" == *"alpha"* ]] || [[ "$TAG" == v0.* ]]; then
|
||||||
|
IS_PRERELEASE="true"
|
||||||
|
fi
|
||||||
|
|
||||||
# Create Release
|
# Create Release
|
||||||
RELEASE_RES=$(curl -s -X POST "$API_URL/repos/$REPO/releases" \
|
RELEASE_RES=$(curl -s -X POST "$API_URL/repos/$REPO/releases" \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"$TAG\", \"name\":\"Release $TAG\", \"body\":\"Automated release\", \"draft\":false, \"prerelease\":false}")
|
-d "{\"tag_name\":\"$TAG\", \"name\":\"Release $TAG\", \"body\":\"Automated release\", \"draft\":false, \"prerelease\":$IS_PRERELEASE}")
|
||||||
|
|
||||||
REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user