A Small Code Bot to Bump Package Version Automatically
Hello fellow developers!
When developing with ObjectScript Package Manager, one crucial thing is the package version, which we place in the module.xml file. When we add changes to the package and are ready to publish a new version of the package in the registry, we also need to increase the version number. This is clear, but it is annoying, and we can often forget to do that.
This small article will help you to automate such a process.

Consider you are using Github with your code repository. I this case, it is possible to use Github Actions and Github bot that will, for example, increase module version with every push into the main or main branch of the repository.
Add the following file into the ./github/workflows folder of your repository:
build-bump.yml
name: versionbump
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
release:
types:
- released
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Bump version
run: |
git config --global user.name 'ProjectBot'
git config --global user.email 'bot@users.noreply.github.com'
VERSION=$(sed -n '0,/.*<Version>\(.*\)<\/Version>.*/s//\1/p' module.xml)
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
sed -i "0,/<Version>\(.*\)<\/Version>/s//<Version>$VERSION<\/Version>/" module.xml
git add module.xml
git commit -m 'auto bump version'
git pushAs you can see, this Github Actions workflow scenario contains one Bump version section that uses ProjectBot user of Github to make changes in module.xml and increase the package version.
That's it! I placed the automation file in the basic template for development. So if you add this file to your repository, the automation will perform automatically.
All credits go to @Dmitry Maslennikov and his project and Github for introducing such a handy tool for developers.
Happy coding!
Comments
nice snippet :)