-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only release if branch stars with v20 (#1411)
Fixes #1404
- Loading branch information
Showing
6 changed files
with
44 additions
and
42 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
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
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 |
---|---|---|
@@ -1,24 +1,42 @@ | ||
import subprocess | ||
|
||
# Get the name of the currently checked out tag | ||
tag_name = subprocess.check_output( | ||
["git", "describe", "--tags", "--exact-match"], text=True | ||
).strip() | ||
|
||
|
||
print(f"Currently checked out tag: {tag_name}") | ||
|
||
# Create a release using gh | ||
subprocess.check_call( | ||
[ | ||
"gh", | ||
"release", | ||
"create", | ||
tag_name, | ||
"--generate-notes", | ||
"ribasim_cli_linux.zip", | ||
"ribasim_cli_windows.zip", | ||
"ribasim_qgis.zip", | ||
"generated_testmodels.zip", | ||
] | ||
) | ||
|
||
def current_git_branch(): | ||
result = subprocess.run( | ||
["git", "rev-parse", "--abbrev-ref", "HEAD"], | ||
capture_output=True, | ||
text=True, | ||
check=True, | ||
) | ||
return result.stdout.strip() | ||
|
||
|
||
def main(): | ||
# Get the name of the currently checked out tag | ||
tag_name = subprocess.check_output( | ||
["git", "describe", "--tags", "--exact-match"], text=True | ||
).strip() | ||
|
||
print(f"Currently checked out tag: {tag_name}") | ||
|
||
# Create a release using gh | ||
subprocess.check_call( | ||
[ | ||
"gh", | ||
"release", | ||
"create", | ||
tag_name, | ||
"--generate-notes", | ||
"ribasim_cli_linux.zip", | ||
"ribasim_cli_windows.zip", | ||
"ribasim_qgis.zip", | ||
"generated_testmodels.zip", | ||
] | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
if current_git_branch().startswith("v20"): | ||
main() | ||
else: | ||
print("Branch doesn't start with 'v20', no release made.") |