diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c1416e23f..2d6b179bc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,7 +24,7 @@ on: jobs: # Build docs on Linux - Docs: + docs: timeout-minutes: 10 name: linux docs runs-on: ubuntu-latest diff --git a/.github/workflows/update_dev_version.yml b/.github/workflows/update_dev_version.yml new file mode 100644 index 000000000..5682a82d5 --- /dev/null +++ b/.github/workflows/update_dev_version.yml @@ -0,0 +1,43 @@ +name: Update Version +on: + pull_request_review: + types: [submitted] + +jobs: + update-version: + if: github.event.review.state == 'approved' + defaults: + run: + shell: bash -l {0} + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + - name: configure git + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" + - name: Calculate new dev version + run: | + 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" >> $GITHUB_ENV + else + echo "NEW_VERSION=.dev$(( $DEV_VERSION + 1))" >> $GITHUB_ENV + fi + - name: update version + env: + GH_TOKEN: ${{ github.token }} + BRANCH_NAME: ${{ github.event.pull_request.head.ref }} + PR_NUMBER: ${{ github.event.pull_request.number}} + run: | + git checkout -b $BRANCH_NAME + git pull + 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 $BRANCH_NAME + gh pr comment $PR_NUMBER -b "I've updated the version for you. Feel free to merge now!" diff --git a/docs/changelog.rst b/docs/changelog.rst index 33df66276..a9874d21d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,6 +14,7 @@ Added - docs now include a dropdown for selecting older versions of the docs. (#457) - Support for loading the same data source but from different places (e.g. local & aws) - Add support for reading and writing tabular data in ``parquet`` format. (PR #445) +- Versions of HydroMT between releases are now updated automatically when the PR is approved. (#455) Changed ------- diff --git a/docs/dev/contributing.rst b/docs/dev/contributing.rst index 3c14bef11..c5282ead9 100644 --- a/docs/dev/contributing.rst +++ b/docs/dev/contributing.rst @@ -37,7 +37,8 @@ If you found a bug or an issue you would like to tackle or contribute to a new d 4. Update docs/changelog.rst file with a summary of your changes and a link to your pull request. See for example the `hydromt changelog `_. 5. Push your commits to the github repository and open a draft pull request. The body of the pull request will be pre-filled with a template. Please fill out this template with the relevant information, and complete the checklist included. 6. Once you're satisfied with the changes mark the pull request as "as ready for review" and ask another contributor to review the code. The review should cover the implementation as well as steps 2-4. -7. Merge the pull request once the review has been approved. +7. Once your request has been approved, a bot will add a commit to your branch to automatically update the version number. Please wait for this to complete before you merge. Once it is done, a comment saying "You're free to merge now" will be added to your PR. You are now free to merge your request. +8. Note that if you want to make changes after this commit has been added, you should pull the branch first to avoid merge conflicts. .. _git-conventions: @@ -181,7 +182,7 @@ It's telling us we first need to tell it what we want to do with the current con Success! This is a simple introduction into a potentially very complicated subject. You can read more about the different possibilities here: -* `Merge Conflicts `_ +* `Merge Conflicts `_ * `Merge Strategies `_