Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DX-3571] ci: update version alpha #178

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
# - major
required: true
default: patch
mark_as_alpha:
type: boolean
description: Mark as alpha release
required: false
default: false

jobs:
update:
Expand Down Expand Up @@ -40,26 +45,23 @@ jobs:
run: |
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h
UPGRADE_TYPE=${{ github.event.inputs.upgrade_type }}
MARK_AS_ALPHA=${{ github.event.inputs.mark_as_alpha }}

RAW_VERSION=$(grep -oP '#define ENGINE_SDK_VERSION TEXT\("\K[0-9]+\.[0-9]+\.[0-9]+(\.[a-zA-Z]+)?' $FILE)

VERSION=$(echo "$RAW_VERSION" | grep -oP '^[0-9]+\.[0-9]+\.[0-9]+')
HAS_ALPHA=$(echo "$RAW_VERSION" | grep -q "\.alpha" && echo "true" || echo "false")

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

# If the version had an alpha suffix, adjust the version bump behavior
if [[ "$RAW_VERSION" == *".alpha" ]]; then
if [[ "$HAS_ALPHA" == "true" ]]; then
if [ "$UPGRADE_TYPE" == "patch" ]; then
# Remove alpha suffix, keep the same version
UPDATED_VERSION="$major.$minor.$patch"
elif [ "$UPGRADE_TYPE" == "minor" ]; then
# E.g. skip 1.3.0, go directly to 1.4.0
minor=$((minor + 1))
patch=0
UPDATED_VERSION="$major.$minor.$patch"
fi
else
# Increment patch or minor
if [ "$UPGRADE_TYPE" == "patch" ]; then
patch=$((patch + 1))
elif [ "$UPGRADE_TYPE" == "minor" ]; then
Expand All @@ -69,6 +71,10 @@ jobs:
UPDATED_VERSION="$major.$minor.$patch"
fi

if [[ "$MARK_AS_ALPHA" == "true" && "$HAS_ALPHA" == "false" ]]; then
UPDATED_VERSION="$UPDATED_VERSION.alpha"
fi

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

echo "Updated version: $UPDATED_VERSION"
Expand Down
Loading