-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI check for updated version on actual code change (#682)
* Add CI check for updated version on actual code change * remove accidentally added newline * dont bump version
- Loading branch information
1 parent
6a461ae
commit d14f75f
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
if git diff --name-only origin/main | grep ".*\.py$" > /dev/null 2>&1; then | ||
# Found modified stuff, make sure version is bumped! | ||
MAIN_TAG=$(git describe origin/main --tags --abbrev=0) | ||
CURRENT_VERSION=$(poetry version --short 2>/dev/null) | ||
|
||
GIT_ROOT=$(git rev-parse --show-toplevel) | ||
# Script exits with return code 1 if the check fails. | ||
python ${GIT_ROOT}/.github/scripts/compare_versions.py ${MAIN_TAG} ${CURRENT_VERSION} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This script checks if current version is larger than latest main version. | ||
|
||
import sys | ||
|
||
from packaging import version | ||
|
||
main_tag = sys.argv[1] | ||
current_version = sys.argv[2] | ||
|
||
# We want this program to exit 1 when the check fails. | ||
# Since `True` == `1`, we want this comparison to evaluate to `0` if we | ||
# want the check to pass. | ||
sys.exit(version.parse(main_tag) >= version.parse(current_version)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters