|
| 1 | +import re |
1 | 2 | import os
|
2 | 3 | from pathlib import Path
|
3 | 4 | from tempfile import NamedTemporaryFile
|
@@ -58,8 +59,13 @@ def from_line(cls, line: str, inner_delimiter: str) -> "GitTag":
|
58 | 59 | return cls(name=name, rev=obj, date=date)
|
59 | 60 |
|
60 | 61 |
|
61 | | -def tag(tag: str, annotated: bool = False) -> cmd.Command: |
62 | | - c = cmd.run(f"git tag -a {tag} -m {tag}" if annotated else f"git tag {tag}") |
| 62 | +def tag(tag: str, annotated: bool = False, signed: bool = False) -> cmd.Command: |
| 63 | + _opt = "" |
| 64 | + if annotated: |
| 65 | + _opt = f"-a {tag} -m" |
| 66 | + if signed: |
| 67 | + _opt = f"-s {tag} -m" |
| 68 | + c = cmd.run(f"git tag {_opt} {tag}") |
63 | 69 | return c
|
64 | 70 |
|
65 | 71 |
|
@@ -136,6 +142,14 @@ def tag_exist(tag: str) -> bool:
|
136 | 142 | return tag in c.out
|
137 | 143 |
|
138 | 144 |
|
| 145 | +def is_signed_tag(tag: str) -> bool: |
| 146 | + c = cmd.run(f"git tag -v {tag}") |
| 147 | + _ret = False |
| 148 | + if re.match("gpg: Signature made [0-9/:A-Za-z ]*", c.err): |
| 149 | + _ret = True |
| 150 | + return _ret |
| 151 | + |
| 152 | + |
139 | 153 | def get_latest_tag_name() -> Optional[str]:
|
140 | 154 | c = cmd.run("git describe --abbrev=0 --tags")
|
141 | 155 | if c.err:
|
|
0 commit comments