Skip to content

Commit

Permalink
handle version without dev part
Browse files Browse the repository at this point in the history
  • Loading branch information
savente93 committed Jul 28, 2023
1 parent 85b66a8 commit ad5ad70
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/update_dev_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ jobs:
git config user.email "<>"
- name: Calculate new dev version
run: |
echo "NEW_VERSION=$(($(git show main:hydromt/__init__.py | awk '/__version__/{print $0}' | awk -F'dev' '{print $2}' | tr -d '\"') + 1 ))">> $GITHUB_ENV
DEV_VERSION=$(cat hydromt/__init__.py | awk '/__version__/{print $0}' | awk -F'dev' '{print $2}' | tr -d '\"')
if [[ -z $DEV_VERSION ]]; then
echo "NEW_VERSION=.dev1"
else
echo "NEW_VERSION=.dev$(( $DEV_VERSION + 1))"
fi
- name: update version
env:
GH_TOKEN: ${{ github.token }}
run: |
sed -i "s/__version__\s*=\s*\"\([0-9]\+\.[0-9]\+\.[0-9]\+\).dev[0-9]\+\"/__version__ = \"\1.dev$LAST_VERSION\"/" hydromt/__init__.py
sed -i "s/__version__\s*=\s*\"\([0-9]\+\.[0-9]\+\.[0-9]\+\).dev[0-9]\+\"/__version__ = \"\1$NEW_VERSION\"/" hydromt/__init__.py
git add hydromt/__init__.py
git commit -m "update version"
git push origin ${{ github.pull_request.base.ref}}
Expand Down

0 comments on commit ad5ad70

Please sign in to comment.