Skip to content

Commit

Permalink
only release if branch stars with v20 (#1411)
Browse files Browse the repository at this point in the history
Fixes #1404
  • Loading branch information
Jingru923 authored Apr 22, 2024
1 parent 22faa27 commit 46937dd
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 42 deletions.
10 changes: 0 additions & 10 deletions .teamcity/Ribasim/buildTypes/Ribasim_Ribasim_MakeQgisPlugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ zip -r ribasim_qgis.zip ribasim_qgis]]></param>
<requirements>
<does-not-equal id="RQ_338" name="env.OS" value="Windows_NT" />
</requirements>
<build-triggers>
<build-trigger id="TRIGGER_550" type="buildDependencyTrigger">
<parameters>
<param name="afterSuccessfulBuildOnly" value="true" />
<param name="branchFilter"><![CDATA[+:<default>
+:v*]]></param>
<param name="dependsOn" value="Ribasim_Windows_BuildRibasimCli" />
</parameters>
</build-trigger>
</build-triggers>
<cleanup />
</settings>
</build-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ pixi run test-ribasim-api]]></param>
<build-triggers>
<build-trigger id="TRIGGER_642" type="schedulingTrigger">
<parameters>
<param name="branchFilter"><![CDATA[+:<default>
+:v*
+pr:target=main]]></param>
<param name="branchFilter"><![CDATA[+:<default>]]></param>
<param name="cronExpression_dm" value="*" />
<param name="cronExpression_dw" value="?" />
<param name="cronExpression_hour" value="*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ pixi run test-ribasim-cli]]></param>
<build-triggers>
<build-trigger id="TRIGGER_645" type="schedulingTrigger">
<parameters>
<param name="branchFilter"><![CDATA[+:<default>
+:v*
+pr:release*]]></param>
<param name="branchFilter"><![CDATA[+:<default>]]></param>
<param name="cronExpression_dm" value="*" />
<param name="cronExpression_dw" value="?" />
<param name="cronExpression_hour" value="*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
<build-triggers>
<build-trigger id="TRIGGER_631" type="schedulingTrigger">
<parameters>
<param name="branchFilter"><![CDATA[+:<default>
+:v*]]></param>
<param name="branchFilter"><![CDATA[+:<default>]]></param>
<param name="cronExpression_dm" value="*" />
<param name="cronExpression_dw" value="?" />
<param name="cronExpression_hour" value="*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
<build-triggers>
<build-trigger id="TRIGGER_636" type="schedulingTrigger">
<parameters>
<param name="branchFilter"><![CDATA[+:<default>
+:v*]]></param>
<param name="branchFilter"><![CDATA[+:<default>]]></param>
<param name="cronExpression_dm" value="*" />
<param name="cronExpression_dw" value="?" />
<param name="cronExpression_hour" value="*" />
Expand Down
62 changes: 40 additions & 22 deletions utils/github-release.py
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.")

0 comments on commit 46937dd

Please sign in to comment.