-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-increment version number on PR merge into develop
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
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
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 |
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,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 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
2.2.2b0 | ||
2.2.1 |