Skip to content

Commit

Permalink
Auto-increment version number on PR merge into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark2000 committed Jan 23, 2024
1 parent a4d0449 commit a64d478
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/pull-request-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
pull_request:
types:
- closed
branches:
- develop

jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Pull repo
uses: actions/checkout@v2
with:
ref: develop
- name: Bump version
run: ./.github/workflows/version-bumper.sh ./docs/source/bskVersion.txt
- name: Commit and push
run: |
git config user.name github-actions
git config user.email [email protected]
git commit -a -m "[AUTO] Bump version number"
git push
20 changes: 20 additions & 0 deletions .github/workflows/version-bumper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

regex='([0-9]+\.[0-9]+\.)([0-9]+)'

# Read file line by line and process each line
while IFS= read -r version || [[ -n "$version" ]]; do
if [[ $version =~ $regex ]]; then
# Extract the last number and increment it by one
last_number=${BASH_REMATCH[2]}
incremented_number=$((last_number + 1))
# Replace the last number in the line
updated_version=${BASH_REMATCH[1]}$incremented_number
echo "Bumping from $version to $updated_version"
else
echo "Version $version is not in the format X.Y.Z; not updating version number"
exit 0
fi
done < $1

echo "$updated_version" > $1
4 changes: 4 additions & 0 deletions docs/source/Support/bskReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Version |release|
- Added optional facet articulation to the :ref:`facetSRPDynamicEffector` module.
- Fixed a bug where the legacy variable logging API would either, not log at all or log at a rate different to the
requested rate.
- Updated versioning to better follow the `semantic versioning <https://semver.org>`_ standard, in the format
``MAJOR.MINOR.PATCH``. Releases will increment the minor version number, while pull requests into develop will
automatically increment the patch number. This allows users to reference/require specific versions of Basilisk
outside of the release cycle.

Version 2.2.1 (Dec. 22, 2023)
-----------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/bskVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.2b0
2.2.1

0 comments on commit a64d478

Please sign in to comment.