Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev version with GHA #455

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:

jobs:
# Build docs on Linux
Docs:
docs:
timeout-minutes: 10
name: linux docs
runs-on: ubuntu-latest
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/update_dev_version.yml
Original file line number Diff line number Diff line change
@@ -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!"
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
5 changes: 3 additions & 2 deletions docs/dev/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/Deltares/hydromt/blob/main/docs/changelog.rst>`_.
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:
Expand Down Expand Up @@ -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 <https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts>`_
* `Merge Conflicts <https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts>`_
* `Merge Strategies <https://www.atlassian.com/git/tutorials/using-branches/merge-strategy>`_


Expand Down
Loading