Release System: Auto Update 'Addon Table' URLs & Upload Addon Zips #123

Closed
Nick Alberelli wants to merge 3 commits from (deleted):feature/release-system-atuo-update-table into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
32 changed files with 90 additions and 10 deletions

1
.gitattributes vendored
View File

@ -2,3 +2,4 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored
View File

@ -8,7 +8,6 @@ __pycache__/
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/

View File

@ -0,0 +1 @@
a1794a7d12f2bb2d49302e682099608fb310b62c6873ef5c1e514cbf0be4d6b2 anim_cupboard-0.0.2.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a1794a7d12f2bb2d49302e682099608fb310b62c6873ef5c1e514cbf0be4d6b2
size 23182

View File

@ -0,0 +1 @@
498847bca3ae34f840ac61682352f5e3c4f38ccbdf0f41f5a845ac9fb5c51b08 asset_pipeline-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:498847bca3ae34f840ac61682352f5e3c4f38ccbdf0f41f5a845ac9fb5c51b08
size 102540

View File

@ -0,0 +1 @@
3f35f32efaa935830db5a22d9ee03006b64d613a345194c89f17e3c18ac75b6c blender_kitsu-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f35f32efaa935830db5a22d9ee03006b64d613a345194c89f17e3c18ac75b6c
size 429579

View File

@ -0,0 +1 @@
65631c02457dc2e90431da92b2ea848722a4e2d7e496e310b24cfee933d137e8 blender_svn-0.2.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:65631c02457dc2e90431da92b2ea848722a4e2d7e496e310b24cfee933d137e8
size 332860

View File

@ -0,0 +1 @@
f2d5eb1aa152e0a2b23cadd76003f4845039bc4c1f14bd069785c45ebebfc050 bone_gizmos-0.0.2.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f2d5eb1aa152e0a2b23cadd76003f4845039bc4c1f14bd069785c45ebebfc050
size 30072

View File

@ -0,0 +1 @@
ad08e6c186dae1619d692c049af4c9fd1a529fa7973f31054637d804cd38d7af cache_manager-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad08e6c186dae1619d692c049af4c9fd1a529fa7973f31054637d804cd38d7af
size 46469

View File

@ -0,0 +1 @@
9b598006dca3489db5949ead90ad181e7cb50b3ec9739bcc6a06b41ec5b34dee contactsheet-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b598006dca3489db5949ead90ad181e7cb50b3ec9739bcc6a06b41ec5b34dee
size 33473

View File

@ -0,0 +1 @@
84e6a59d9a2381bac5dc85ca504c707560e5d74d4399773b0cf8e5f674a6ac01 easy_weights-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84e6a59d9a2381bac5dc85ca504c707560e5d74d4399773b0cf8e5f674a6ac01
size 30507

View File

@ -0,0 +1 @@
2f6cadfa3287672ba796e490909da875b0240e7f3174b7c1fefdb18c887443ca geonode_shapekeys-0.0.2.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f6cadfa3287672ba796e490909da875b0240e7f3174b7c1fefdb18c887443ca
size 225768

View File

@ -0,0 +1 @@
add974faba7c26f7e5342ad0b50e62ec08dc7f7441f71565ddbd95354e60998e grease_converter-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:add974faba7c26f7e5342ad0b50e62ec08dc7f7441f71565ddbd95354e60998e
size 4904

View File

@ -0,0 +1 @@
4e9e25a50c820f38f88979d070834051860b61df96053df68d592b5a1aa052f5 lattice_magic-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e9e25a50c820f38f88979d070834051860b61df96053df68d592b5a1aa052f5
size 16785

View File

@ -0,0 +1 @@
616a03fed057c5009a7f6382dca1e5cdee6f82f829c8ed7be894b8e2e0ab6afd lighting_overrider-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:616a03fed057c5009a7f6382dca1e5cdee6f82f829c8ed7be894b8e2e0ab6afd
size 28911

View File

@ -0,0 +1 @@
086f6c7723a0ce4c32e58a6c239c8e07f0dca095e8b53742f930362c3ab4204f pose_shape_keys-0.0.2.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:086f6c7723a0ce4c32e58a6c239c8e07f0dca095e8b53742f930362c3ab4204f
size 30784

View File

@ -0,0 +1 @@
ce1aaf7eeb386ad9e0e846f3646d1e5a927b8c6ad65d33494324bf189edb2f6b render_review-0.1.1.zip

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce1aaf7eeb386ad9e0e846f3646d1e5a927b8c6ad65d33494324bf189edb2f6b
size 42221

View File

@ -124,6 +124,17 @@ def write_file(file_path: Path, content):
file.close()
def replace_line(file_path: Path, new_line: str, line_number: int):
file = open(
file_path,
)
lines = file.readlines()
lines[line_number] = new_line
out = open(file_path, 'w')
out.writelines(lines)
out.close()
def get_directory(repo_root: Path, folder_name: str) -> Path:
"""Returns directory PATH, creates one if none exists"""
path = repo_root.joinpath(folder_name)
@ -263,6 +274,20 @@ def changelog_file_write(file_path: Path, content: str):
return file_path
def update_release_table(addon_dir: Path, version: str):
table_file = addon_dir.parent.parent.joinpath("README.md")
with open(table_file, 'r') as myFile:
for num, line in enumerate(myFile):
if addon_dir.name in line:
line_to_replace = num
break # Use first line found
splitted_line = line.split("|[v")
version_bump_text = splitted_line[1].replace(splitted_line[1][0:5], version)
new_line = line[: len(splitted_line[0]) + 3] + version_bump_text
replace_line(table_file, new_line, line_to_replace)
return table_file
def addon_package(directory: Path, commit_prefix: str, is_major=False, force=False):
"""
For a give directory, if new commits are found after the commit matching 'commit_prefix',
@ -282,9 +307,11 @@ def addon_package(directory: Path, commit_prefix: str, is_major=False, force=Fal
change_log_file = changelog_file_write(
directory.joinpath("CHANGELOG.md"), change_log
)
table_file = update_release_table(directory, version)
cli_command(f'git reset')
cli_command(f'git stage {change_log_file}')
cli_command(f'git stage {init_file}')
cli_command(f'git stage {table_file}')
subprocess.run(
['git', 'commit', '-m', f"Version Bump: {directory.name} {version}"],
capture_output=True,
@ -352,10 +379,7 @@ def addon_version_bump(directory: Path, is_major: bool):
lines = file.readlines()
version = addon_version_get(lines[version_line], is_major)
repl_str = f' "version": ({version}),\n'
lines[version_line] = repl_str
out = open(init_file, 'w')
out.writelines(lines)
out.close()
replace_line(init_file, repl_str, version_line)
return init_file, version.replace(', ', '.').replace(',', '.')