Skip to content

1 apply personal GitHub template #2

1 apply personal GitHub template

1 apply personal GitHub template #2

Workflow file for this run

name: Increment Minor Version
on:
pull_request:
branches: [ dev ]
jobs:
increment_minor_version:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Increment Minor Version
run: |
# Get the latest tag from the repository
latest_tag=$(git describe --tags --abbrev=0)
if [[ -z "$latest_tag" ]]; then
echo "Failed to get the latest tag."
latest_tag="v0.0.0"
fi
# Extract the major, minor, and patch versions from the tag
regex="([0-9]+)\.([0-9]+)\.([0-9]+)"
if [[ $latest_tag =~ $regex ]]; then
major_version="${BASH_REMATCH[1]}"
minor_version="${BASH_REMATCH[2]}"
old_minor_version="${BASH_REMATCH[2]}"
patch_version="${BASH_REMATCH[3]}"
old_patch_version="${BASH_REMATCH[3]}"
else
echo "Failed to parse the latest tag version."
exit 1
fi
# Increment the minor version
((minor_version++))
# Set the patch version to 0
patch_version=0
# Construct the new version
new_version="v${major_version}.${minor_version}.${patch_version}"
# Replace the version in all relevant files except those in the 'Launcher' and 'Libs' folders
find . -type f -exec sed -i "s/$latest_tag/$new_version/g" {} \;
# Commit the changes
git config user.name "Flakkari-Bot"
git config user.email "[email protected]"
git add .
git commit -m "update(root): Increment minor version to $new_version"
git push
# Create a new tag
git tag -a $new_version -m "Flakkari $new_version"
git push --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}