Skip to content

Automatic Version Bump #7

Automatic Version Bump

Automatic Version Bump #7

Workflow file for this run

name: Automatically bump version
on:
workflow_dispatch:
schedule:
- cron: "0 0,6,12,18 * * *"
pull_request:
concurrency:
group: "bump"
cancel-in-progress: true
permissions:
contents: write
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump version
run: |
git config --global user.name "Github Action Automation"
git config --global user.email "nsg@users.noreply.github.com"
OLD_VERSION=$(cat VERSION)
make version-update
NEW_VERSION=$(cat VERSION)
BRANCH_NAME="bump-$NEW_VERSION"
REMOTE_URL=$(git remote get-url origin)
if git ls-remote --exit-code "$REMOTE_URL" "refs/heads/$BRANCH_NAME" >/dev/null 2>&1; then
echo "Branch $BRANCH_NAME already exists."
exit 0
fi
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
git checkout -b $BRANCH_NAME
git add .
git commit -m "Bump version to $NEW_VERSION"
git push -u origin $BRANCH_NAME
fi
# - name: Create pull request
# run: >
# gh pr create -B master -H test123 --title 'TEST: V1.71' --body 'Created by Github action'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}