Skip to content

Update Dev Version on Release #31

Update Dev Version on Release

Update Dev Version on Release #31

Workflow file for this run

name: Update Dev Version on Release
on:
workflow_dispatch:
workflow_run:
workflows: [Upload Package to PyPI]
types: [completed]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout New Branch
run: |
git checkout -b update_dev_version
- name: Update dev version
run: |
git fetch --prune --unshallow --tags
IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)"
echo $tags
latest_tag=${y[${#y[@]} - 1]}
old_version="${latest_tag:1}"
echo "Old Version: $old_version"
IFS=$'.' read -rd '' -a split_old_version <<<"$old_version"
old_major_version=${split_old_version[0]}
old_minor_version=${split_old_version[1]}
old_patch_version=${split_old_version[2]}
new_patch_version=`expr $old_patch_version + 1`
new_version="$old_major_version.$old_minor_version.$new_patch_version"
echo "New Version: $new_version"
sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py
echo "old_version=$old_version" >> "$GITHUB_ENV"
echo "new_version=$new_version" >> "$GITHUB_ENV"
shell: bash
- name: Commit Changes and Create Pull Request
run: |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name github-actions[bot]
git commit . -m "Update dev version from $old_version to $new_version"
git push origin update_dev_version
gh pr create --title "[Github.CI] Update dev version from $old_version to $new_version" --body "version: $old_version --> $new_version"
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}