Skip to content

Commit 46fcefc

Browse files
committed
d
1 parent e5fdbee commit 46fcefc

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/publish_release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ jobs:
3232
run: |
3333
python -m pip install --upgrade pip
3434
pip install -r ./requirements.txt -t ./lib
35-
zip -r ${{ github.event.repository.name }}.zip . -x '*.git*'
35+
36+
- name: Build Plugin
37+
run: |
38+
py build_plugin.py ${{ github.event.repository.name }}.zip
3639
3740
- name: Publish
3841
if: success()

build_plugin.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
import zipfile
3+
from pathlib import Path
4+
5+
6+
def main(archive_name: str):
7+
files = [
8+
Path(fp)
9+
for fp in (
10+
"plugin.json",
11+
"main.py",
12+
"assets/app.png",
13+
"assets/error.png",
14+
)
15+
]
16+
17+
plugin_dir = Path("plugin")
18+
files.extend(plugin_dir.rglob(f"**.py"))
19+
20+
lib_dir = Path("lib")
21+
files.extend(lib_dir.rglob("*"))
22+
23+
with zipfile.ZipFile(archive_name, "w") as f:
24+
for file in files:
25+
f.write(file)
26+
print(f"Added {file}")
27+
print(f"\nDone. Archive saved to {archive_name}")
28+
29+
30+
if __name__ == "__main__":
31+
main(sys.argv[-1])

0 commit comments

Comments
 (0)