Skip to content

Commit

Permalink
Version workflow (#290)
Browse files Browse the repository at this point in the history
* use gh cli directly

* set git config

* added logging to debug

* debug

* debugged version tags

* debug logging

* debug

* debug

* debug

* revert version in setup.py to test workflow

* remove space in sed command

* passed along version numbers as environment variables

* Update version back to 0.5.7
  • Loading branch information
pauladkisson authored Feb 21, 2024
1 parent 0a223a5 commit 0f46b2c
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,31 @@ jobs:
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: |
old_version=${{ github.event.release.tag_name }}
git fetch --prune --unshallow --tags
tags="$(git tag --list)"
latest_tag=${tags: -6 : 6}
old_version=${latest_tag:1:5}
echo "Old Version: $old_version"
old_major_version=${old_version:0:1}
old_minor_version=${old_version:2:1}
old_patch_version=${old_version:4:1}
new_patch_version=`expr $old_patch_version + 1`
new_version="$old_major_version.$old_minor_version.$new_patch_version"
sed -i -e "s/version = \"$old_version\"/version = \"$new_version\"/g" setup.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
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"
- 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.GITHUB_TOKEN }}

0 comments on commit 0f46b2c

Please sign in to comment.