ci: use sourcehut for PyPi deploy

This commit is contained in:
Sumner Evans
2021-05-05 10:14:48 -06:00
parent 3976bffe81
commit faaa6503e8
3 changed files with 41 additions and 41 deletions

28
cicd/tagged_with_version Executable file
View File

@@ -0,0 +1,28 @@
#! /usr/bin/env python
import re
import subprocess
import sys
version_tag_re = re.compile(r"v\d+\.\d+\.\d+")
tags = (
subprocess.run(["git", "tag", "--contains", "HEAD"], capture_output=True)
.stdout.decode()
.strip()
.split()
)
# If one of the tags is a version tag, then run the commands specified in the
# parameters.
for tag in tags:
if match := version_tag_re.match(tag):
print(f"VERSION TAG {tag} FOUND")
sys.exit(0)
# Don't run the else statement of the for loop.
break
else:
print("NO VERSION TAG FOUND")
sys.exit(1)