-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.py
40 lines (32 loc) · 1.26 KB
/
publish.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import urllib.parse
import tomlkit
from build import SIZES, DOWNLOAD_URLS, PYPROJECT_PATH
pyproject_toml = tomlkit.parse(PYPROJECT_PATH.read_text(encoding="UTF-8"))
VERSION = pyproject_toml["tool"]["poetry"]["version"]
GIT_VERSION = f"v{VERSION}"
if __name__ == "__main__":
os.system("git add pyproject.toml README.md previews/*.webp")
os.system(f"git commit -m \"version: {GIT_VERSION}\"")
os.system(f"git tag {GIT_VERSION}")
# os.system("cd .. && bfg --delete-files \"*.sh3t\" sweethome3d-textures-ambientcg")
os.system("git reflog expire --expire=now --all && git gc --prune=now --aggressive")
os.system("git push --force")
os.system("git push --force --tags")
download_versions = [
# f"- [ambientcg_{size}.sh3t](https://github.com/fabien-michel/sweethome3d-textures-ambientcg/raw/{GIT_VERSION}/ambientcg_{size}.sh3t)"
f"- [ambientcg_{size}.sh3t]({DOWNLOAD_URLS[size]})"
for size in SIZES
]
body = "\n".join(download_versions)
params = urllib.parse.urlencode(
{
"tag": GIT_VERSION,
"title": GIT_VERSION,
"body": body,
}
)
print(
"https://github.com/fabien-michel/sweethome3d-textures-ambientcg/releases/new?"
+ params
)