Skip to content

Commit 801ae1f

Browse files
Merge pull request #178 from immutable/ci/update-version-action-alpha
[DX-3571] ci: update version alpha
2 parents 12842b2 + 6dc66fd commit 801ae1f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/update-version.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
# - major
1414
required: true
1515
default: patch
16+
mark_as_alpha:
17+
type: boolean
18+
description: Mark as alpha release
19+
required: false
20+
default: false
1621

1722
jobs:
1823
update:
@@ -40,26 +45,23 @@ jobs:
4045
run: |
4146
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h
4247
UPGRADE_TYPE=${{ github.event.inputs.upgrade_type }}
48+
MARK_AS_ALPHA=${{ github.event.inputs.mark_as_alpha }}
4349
4450
RAW_VERSION=$(grep -oP '#define ENGINE_SDK_VERSION TEXT\("\K[0-9]+\.[0-9]+\.[0-9]+(\.[a-zA-Z]+)?' $FILE)
45-
4651
VERSION=$(echo "$RAW_VERSION" | grep -oP '^[0-9]+\.[0-9]+\.[0-9]+')
52+
HAS_ALPHA=$(echo "$RAW_VERSION" | grep -q "\.alpha" && echo "true" || echo "false")
4753

4854
IFS='.' read -r major minor patch <<< "$VERSION"
4955

50-
# If the version had an alpha suffix, adjust the version bump behavior
51-
if [[ "$RAW_VERSION" == *".alpha" ]]; then
56+
if [[ "$HAS_ALPHA" == "true" ]]; then
5257
if [ "$UPGRADE_TYPE" == "patch" ]; then
53-
# Remove alpha suffix, keep the same version
5458
UPDATED_VERSION="$major.$minor.$patch"
5559
elif [ "$UPGRADE_TYPE" == "minor" ]; then
56-
# E.g. skip 1.3.0, go directly to 1.4.0
5760
minor=$((minor + 1))
5861
patch=0
5962
UPDATED_VERSION="$major.$minor.$patch"
6063
fi
6164
else
62-
# Increment patch or minor
6365
if [ "$UPGRADE_TYPE" == "patch" ]; then
6466
patch=$((patch + 1))
6567
elif [ "$UPGRADE_TYPE" == "minor" ]; then
@@ -69,6 +71,10 @@ jobs:
6971
UPDATED_VERSION="$major.$minor.$patch"
7072
fi
7173

74+
if [[ "$MARK_AS_ALPHA" == "true" && "$HAS_ALPHA" == "false" ]]; then
75+
UPDATED_VERSION="$UPDATED_VERSION.alpha"
76+
fi
77+
7278
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+(\.[a-zA-Z]+)?\"\)/#define ENGINE_SDK_VERSION TEXT(\"$UPDATED_VERSION\")/g" $FILE
7379

7480
echo "Updated version: $UPDATED_VERSION"

0 commit comments

Comments
 (0)