Merge pull request #883 from Bram-Hub/dev #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
name: Increment Version on Push | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
increment_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Determine new version | |
id: update_version | |
run: | | |
current_version=$(<legup-update/bin/main/edu.rpi.legupupdate/VERSION) | |
IFS='.' read -r -a version_parts <<< "$current_version" | |
first_part="${version_parts[0]}" | |
second_part="${version_parts[1]}" | |
last_part="${version_parts[2]}" | |
if [[ $last_part -eq 9 ]]; then | |
new_last_part=0 | |
if [[ $second_part -eq 9 ]]; then | |
new_second_part=0 | |
new_first_part=$((first_part + 1)) | |
else | |
new_second_part=$((second_part + 1)) | |
new_first_part=$first_part | |
fi | |
else | |
new_last_part=$((last_part + 1)) | |
new_second_part=$second_part | |
new_first_part=$first_part | |
fi | |
new_version="$new_first_part.$new_second_part.$new_last_part" | |
echo "New version: $new_version" | |
echo "::set-output name=version::$new_version" | |
- name: Update version.txt with new version | |
run: echo "${{ steps.update_version.outputs.version }}" > legup-update/bin/main/edu.rpi.legupupdate/VERSION | |
- name: Commit and push changes | |
run: | | |
git config --global user.email "pitbull51067@yahoo.com" | |
git config --global user.name "Pitbull51067" | |
git add -f legup-update/bin/main/edu.rpi.legupupdate/VERSION | |
git commit -m "Increment version number" | |
git push |