Skip to content

Update VERSION

Update VERSION #5

Workflow file for this run

name: Update Version with Commit Hash
on:
push:
branches:
- main
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get current version and commit hash
id: get_info
run: |
CURRENT_VERSION=$(cat VERSION)
COMMIT_HASH=$(git rev-parse HEAD)
echo "Current version: $CURRENT_VERSION"
echo "Commit hash: $COMMIT_HASH"
echo "::set-output name=current_version::$CURRENT_VERSION"
echo "::set-output name=commit_hash::$COMMIT_HASH"
- name: Update version
id: update_version
run: |
IFS='.' read -r major minor patch <<< "${{ steps.get_info.outputs.current_version }}"
new_patch=$((patch + 1))
new_version="$major.$minor.$new_patch+${{ steps.get_info.outputs.commit_hash }}"
echo "New version: $new_version"
echo "$new_version" > 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.update_version.outputs.new_version }}" || echo "No changes to commit"
git push