-
Notifications
You must be signed in to change notification settings - Fork 30
34 lines (31 loc) · 1.16 KB
/
update_dev_version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Update Version
on:
pull_request_review:
types: [submitted]
workflow_dispatch:
jobs:
update-version:
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'approved'
defaults:
run:
shell: bash -l {0}
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: configure git
run: |
git config user.name "GitHub Actions Bot"
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
- 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
git add hydromt/__init__.py
git commit -m "update version"
git push origin ${{ github.ref_name}}
gh pr comment ${{ github.ref_name }} -b "I've updated the version for you. Feel free to merge now!"