Merge pull request #27 from 0xBLCKLPTN/alice_database-dev #52
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: Update Version | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get current version | |
id: get_version | |
run: | | |
LAST_COMMIT_HASH=$(git rev-parse HEAD) # Получаем полный хеш | |
VERSION=$(cat VERSION) | |
echo "Current version: $VERSION" | |
echo "::set-output name=current_version::$VERSION" | |
- name: Increment version | |
id: increment_version | |
run: | | |
IFS='.' read -r major minor patch <<< "${{ steps.get_version.outputs.current_version }}" | |
new_patch=$((patch + 1)) | |
new_version="$major.$minor.$new_patch" | |
echo "New version: $new_version" | |
echo "$new_version" > VERSION | |
echo "::set-output name=new_version::$new_version" | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add VERSION | |
git commit -m "Update version to ${{ steps.increment_version.outputs.new_version }}" || echo "No changes to commit" | |
git push |