Skip to content

Commit 7a2efd5

Browse files
jnnsbrrjnnsbrr
authored andcommitted
smalladjustments
1 parent af3399f commit 7a2efd5

1 file changed

Lines changed: 11 additions & 25 deletions

File tree

pycoupler/release.py

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def run_command(cmd, description, fail_on_error=True):
143143

144144

145145
def delete_tag_if_exists(tag_name):
146-
"""Delete a tag locally and remotely if it exists."""
147-
print(f"Checking if tag {tag_name} already exists...")
146+
"""Delete a tag locally if it exists. Remote tags are handled during manual push."""
147+
print(f"Checking if tag {tag_name} already exists locally...")
148148

149149
# Check if tag exists locally (fast)
150150
try:
@@ -163,27 +163,8 @@ def delete_tag_if_exists(tag_name):
163163
except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
164164
print(f"Tag {tag_name} does not exist locally")
165165

166-
# Check if tag exists remotely (with timeout)
167-
try:
168-
result = subprocess.run(
169-
["git", "ls-remote", "--tags", "origin", tag_name],
170-
check=True,
171-
capture_output=True,
172-
text=True,
173-
timeout=10,
174-
)
175-
if tag_name in result.stdout:
176-
print(f"Tag {tag_name} exists remotely, deleting...")
177-
run_command(
178-
f"git push origin :refs/tags/{tag_name}",
179-
f"Deleting remote tag {tag_name}",
180-
)
181-
else:
182-
print(f"Tag {tag_name} does not exist remotely")
183-
except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
184-
print(f"Tag {tag_name} does not exist remotely (or network timeout)")
185-
186-
print(f"Tag {tag_name} cleanup completed.")
166+
print(f"Local tag {tag_name} cleanup completed.")
167+
print("Note: Remote tags will be handled when you manually push with --tags")
187168

188169

189170
def update_citation_file(version, date=None):
@@ -238,7 +219,7 @@ def main():
238219
print(" - Run linting with flake8")
239220
print(" - Update CITATION.cff (if needed)")
240221
print(" - Commit changes")
241-
print(" - Delete existing tag (if it exists)")
222+
print(" - Delete existing local tag (if it exists)")
242223
print(" - Create Git tag")
243224
print("")
244225
print("Prerequisites: Install dev dependencies first:")
@@ -339,7 +320,7 @@ def main():
339320
# Check if there are changes to commit
340321
try:
341322
result = subprocess.run(
342-
["git", "diff", "--quiet", "CITATION.cff"], capture_output=True, text=True
323+
["git", "diff", "--quiet", "CITATION.cff"], capture_output=True, text=True # noqa: E501
343324
)
344325
has_changes = result.returncode != 0
345326
except subprocess.CalledProcessError:
@@ -371,6 +352,11 @@ def main():
371352
print("To push to repository, run:")
372353
print(f" git push origin {current_branch} --tags")
373354
print("")
355+
print("Note: If this is a re-release and the tag exists remotely,")
356+
print("you may need to force push the tag:")
357+
print(f" git push origin :refs/tags/v{version} # Delete remote tag")
358+
print(f" git push origin v{version} # Push new tag")
359+
print("")
374360
print("The CI pipeline will automatically:")
375361
print(" - Run tests with pytest and coverage")
376362
print(" - Check code formatting with black")

0 commit comments

Comments
 (0)