Skip to content

Commit

Permalink
ci: update update-version.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 authored Feb 7, 2025
1 parent 25ebb4e commit b993ed2
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ name: "Update engine SDK version in ImmutableDataTypes.h"
on:
workflow_dispatch:
inputs:
version:
description: 'Version to update to (e.g. 1.20.0)'
upgrade_type:
type: choice
description: Upgrade Type
options:
- patch
- minor
# - major
required: true
default: patch

jobs:
update:
Expand Down Expand Up @@ -34,7 +40,24 @@ jobs:
run: |
FILE=./Source/Immutable/Public/Immutable/ImmutableDataTypes.h
VERSION=${{ github.event.inputs.version }}
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+\"\)/#define ENGINE_SDK_VERSION TEXT(\"$VERSION\")/g" $FILE
UPGRADE_TYPE=${{ github.event.inputs.upgrade_type }}
# Split version into components
IFS='.' read -r major minor patch <<< "$VERSION"
# Update version based on upgrade_type
if [ "$UPGRADE_TYPE" == "patch" ]; then
patch=$((patch + 1)) # Increment patch version
elif [ "$UPGRADE_TYPE" == "minor" ]; then
minor=$((minor + 1)) # Increment minor version and reset patch
patch=0
fi

# Format the updated version
UPDATED_VERSION="$major.$minor.$patch"

# Replace the version string in the file
sed -i -E "s/#define ENGINE_SDK_VERSION TEXT\(\"[0-9]+\.[0-9]+\.[0-9]+\"\)/#define ENGINE_SDK_VERSION TEXT(\"$UPDATED_VERSION\")/g" $FILE

- uses: gr2m/create-or-update-pull-request-action@v1
env:
Expand Down

0 comments on commit b993ed2

Please sign in to comment.