|
1 | 1 | from os import path |
2 | | -from types import SimpleNamespace as sns |
3 | 2 | import sys |
| 3 | +from types import SimpleNamespace as sns |
4 | 4 | import tomli, tomli_w |
5 | 5 |
|
6 | 6 | # Init logger |
7 | 7 | sys.path.insert(0, path.join(path.dirname(__file__), '../src')) |
8 | 8 | from translate_messages.lib import log # type: ignore |
9 | 9 |
|
10 | | -# Load pyproject.toml |
| 10 | +# Init project data |
11 | 11 | pyproject_path = path.join(path.dirname(__file__), '../pyproject.toml') |
12 | 12 | log.info(f'Loading {pyproject_path}...') |
13 | 13 | with open(pyproject_path, 'rb') as file : pyproject = tomli.load(file) |
14 | 14 | project = sns(**pyproject['project']) |
15 | 15 |
|
16 | 16 | def update_changelog_url(): |
17 | | - ver_tag = f'{project.name}-{project.version}' |
18 | | - changelog_url = f'https://github.com/adamlui/python-utils/releases/tag/{ver_tag}' |
19 | | - log.data(f'Generated changelog URL: {changelog_url}') |
| 17 | + new_ver_tag = f'{project.name}-{project.version}' |
| 18 | + new_changelog_url = f"{project.urls['Releases']}/tag/{new_ver_tag}" |
| 19 | + log.data(f'Generated changelog URL: {new_changelog_url}') |
20 | 20 | log.info(f"{ 'Updating' if 'Changelog' in project.urls else 'Adding new' } Changelog URL...") |
21 | | - project.urls['Changelog'] = changelog_url |
| 21 | + project.urls['Changelog'] = new_changelog_url |
22 | 22 | pyproject['project'] = vars(project) # update og dict for dumping |
23 | 23 | with open(pyproject_path, 'wb') as file : tomli_w.dump(pyproject, file) |
24 | | - log.success(f'Bumped changelog URL ver tag to [{ver_tag}]!') |
| 24 | + log.success(f'Bumped changelog URL ver tag to [{new_ver_tag}]!') |
25 | 25 |
|
26 | 26 | update_changelog_url() |
0 commit comments