|
1 | 1 | from ..paths import PYPROJECT |
2 | 2 |
|
3 | 3 |
|
| 4 | +def print_gh(p): |
| 5 | + p.p() |
| 6 | + try: |
| 7 | + p.run('gh', 'repo', 'set-default', '--view', out=True) |
| 8 | + except Exception: |
| 9 | + p.p('FAIL') |
| 10 | + except: |
| 11 | + p.p("FUCK!") |
| 12 | + |
| 13 | + |
| 14 | +def name_dirname(p): |
| 15 | + if p.manager and p.name != p.manager["name"]: |
| 16 | + p.p(p.name, p.manager["name"]) |
| 17 | + |
| 18 | + |
4 | 19 | def bump_version(project, rule_or_version='minor'): |
| 20 | + if not (pv := project.version): |
| 21 | + return |
| 22 | + msg = project.git('l', '-1', '--format=%s', out=True).strip() |
| 23 | + if msg.startswith('Update version to '): |
| 24 | + return |
5 | 25 | if project.git.is_dirty(): |
6 | 26 | project.p('Dirty!') |
7 | 27 | return |
8 | | - if not (pv := project.version): |
| 28 | + if not True: |
| 29 | + project.p() |
9 | 30 | return |
| 31 | + print() |
| 32 | + print() |
| 33 | + project.p('bump_version') |
| 34 | + print() |
10 | 35 | project.run('rm', '-rf', 'dist/') |
11 | 36 | project.p('v' + pv) |
12 | 37 | project.uv('version', '--bump', rule_or_version) |
13 | 38 | project = project.reload() |
14 | 39 | assert pv != project.version, pv |
15 | 40 |
|
16 | 41 | version = 'v' + project.version |
17 | | - |
18 | 42 | project.git.commit(f'Update version to {version}', '-a') |
19 | | - if not True: |
20 | | - return |
21 | 43 | project.git('tag', version) |
22 | 44 | project.git('push', '--tag', '--force-with-lease') |
23 | 45 | project.run('gh', 'release', 'create', version, '--generate-notes') |
|
0 commit comments