Skip to content
name: Main Versioning
on:
pull_request:
types: [closed]
branches:
- main
jobs:
update_version:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update VERSION in main
run: |
# Attempt to remove the -DEV suffix from the version number if it exists
NEW_VERSION=$(sed -n 's/^VERSION=\"\(.*\)\(-DEV\)\?\"$/\1/p' scripts/controller.sh)
# Replace VERSION in the file with the NEW_VERSION value
sed -i "s/^VERSION=\".*\"$/VERSION=\"${NEW_VERSION}\"/" scripts/controller.sh
# Check if there are changes to commit
git diff --exit-code || {
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update version to ${NEW_VERSION}"
git push origin main
}