Skip to content

Commit

Permalink
zip during release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NullSenseStudio authored and carson-katri committed May 17, 2024
1 parent f716ac6 commit fe9a9dc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
shell: bash
run: 'python -m pip install -r requirements/win-linux-cuda.txt --no-cache-dir --target .python_dependencies'
working-directory: dream_textures
- name: Zip dependencies with long paths
shell: bash
run: 'python ./dream_textures/scripts/zip_dependencies.py'
- name: Archive Release
uses: thedoctor0/zip-release@main
with:
Expand Down Expand Up @@ -73,6 +76,9 @@ jobs:
shell: bash
run: 'python -m pip install -r requirements/win-dml.txt --no-cache-dir --target .python_dependencies'
working-directory: dream_textures
- name: Zip dependencies with long paths
shell: bash
run: 'python ./dream_textures/scripts/zip_dependencies.py'
- name: Archive Release
uses: thedoctor0/zip-release@main
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
*.so

# Distribution / packaging
.python_dependencies.zip
.Python
build/
develop-eggs/
Expand Down
26 changes: 26 additions & 0 deletions scripts/zip_dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import shutil
import zipfile
from pathlib import Path


def main():
root = Path(__file__).parent.parent
deps = root / '.python_dependencies'
deps_to_zip = [deps / 'transformers']

for dep in deps_to_zip:
if not dep.exists():
raise FileNotFoundError(dep)
elif not dep.is_dir():
raise EnvironmentError(f"not a directory {dep}")

zip_deps_path = root / '.python_dependencies.zip'
zip_deps_path.unlink(True)
with zipfile.PyZipFile(str(zip_deps_path), mode='x') as zip_deps:
for dep in deps_to_zip:
zip_deps.writepy(str(dep))
shutil.rmtree(str(dep))


if __name__ == '__main__':
main()

0 comments on commit fe9a9dc

Please sign in to comment.