Update version.yml #12
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: Versioning | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Read current version | |
id: get_version | |
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
- name: Increment version | |
run: | | |
IFS='.' read -r major minor patch <<< "$VERSION" | |
new_patch=$((patch + 1)) | |
new_version="$major.$minor.$new_patch" | |
echo "$new_version" > VERSION | |
echo "New version: $new_version" | |
- name: Commit and push changes | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git add VERSION | |
git commit -m "Bump version to $new_version" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |