-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into review/asset-streamer
- Loading branch information
Showing
5 changed files
with
122 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Get the PR title from the first argument. | ||
PR_TITLE="$1" | ||
if [[ -z "$PR_TITLE" ]]; then | ||
echo "Error: PR title must be passed as the first argument." | ||
exit 1 | ||
fi | ||
|
||
echo "PR Title: $PR_TITLE" | ||
|
||
# Get the list of changed files between the merge commit and its first parent. | ||
mapfile -t changed_files < <(git diff --name-only HEAD^ HEAD) | ||
echo "Changed files: ${changed_files[@]}" | ||
|
||
# Default bump type is patch. | ||
BUMP_TYPE="patch" | ||
|
||
# Define arrays for directories that trigger a major or minor bump. | ||
major_paths=( | ||
"code/framework/src/networking/messages" | ||
"code/framework/src/networking/rpc" | ||
) | ||
minor_paths=( | ||
"code/framework/src/scripting/builtins" | ||
"code/framework/src/integrations/server/scripting/builtins" | ||
) | ||
|
||
pr_title_lower=$(echo "$PR_TITLE" | tr '[:upper:]' '[:lower:]') | ||
|
||
# Check if PR title enforces a PATCH bump. | ||
if [[ "$pr_title_lower" == *"[patch]"* ]]; then | ||
echo "PR title contains [patch]. Enforcing PATCH bump." | ||
BUMP_TYPE="patch" | ||
else | ||
# Check for major bump directories. | ||
for file in "${changed_files[@]}"; do | ||
for major in "${major_paths[@]}"; do | ||
if [[ "$file" == "$major"* ]]; then | ||
BUMP_TYPE="major" | ||
break 2 | ||
fi | ||
done | ||
done | ||
|
||
# If no major changes were found, check for minor bump directories. | ||
if [[ "$BUMP_TYPE" != "major" ]]; then | ||
for file in "${changed_files[@]}"; do | ||
for minor in "${minor_paths[@]}"; do | ||
if [[ "$file" == "$minor"* ]]; then | ||
BUMP_TYPE="minor" | ||
break 2 | ||
fi | ||
done | ||
done | ||
fi | ||
fi | ||
|
||
echo "Determined bump type: $BUMP_TYPE" | ||
|
||
# Ensure VERSION file exists. | ||
if [ ! -f VERSION ]; then | ||
echo "VERSION file not found. Creating VERSION with default value 0.0.0." | ||
echo "0.0.0" > VERSION | ||
fi | ||
|
||
# Read the current version from the VERSION file. | ||
CURRENT_VERSION=$(cat VERSION) | ||
echo "Current version: $CURRENT_VERSION" | ||
|
||
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | ||
|
||
# Calculate the new version based on the bump type. | ||
case "$BUMP_TYPE" in | ||
major) | ||
NEW_MAJOR=$((MAJOR + 1)) | ||
NEW_VERSION="$NEW_MAJOR.0.0" | ||
;; | ||
minor) | ||
NEW_MINOR=$((MINOR + 1)) | ||
NEW_VERSION="$MAJOR.$NEW_MINOR.0" | ||
;; | ||
patch) | ||
NEW_PATCH=$((PATCH + 1)) | ||
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" | ||
;; | ||
esac | ||
|
||
# Update the VERSION file with the new version. | ||
echo "$NEW_VERSION" > VERSION | ||
echo "Updated version set to: $NEW_VERSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,32 @@ on: | |
types: [closed] | ||
branches: [develop] | ||
|
||
jobs: | ||
evaluate-release: | ||
jobs: | ||
bump-semver: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Ensure full history for diff comparisons | ||
|
||
- name: Run bump semver script | ||
run: | | ||
chmod +x ./.github/bump_version.sh | ||
./.github/bump_version.sh "${{ github.event.pull_request.title }}" | ||
- name: Commit version bump | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git add VERSION | ||
git diff-index --quiet HEAD || git commit -m "Bump version to $(cat VERSION) [skip ci]" | ||
git push origin HEAD:develop --follow-tags | ||
evaluate-release: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
needs: bump-semver | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.0.0 | ||
1.8.1 |