diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 13abe8b..fb7d6b1 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,9 +1,8 @@ name: Publish Python Package on: - push: - branches: - - main + release: + types: [created] jobs: publish: @@ -22,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine keyring + pip install setuptools wheel twine - name: Build package run: python setup.py sdist bdist_wheel @@ -34,7 +33,6 @@ jobs: run: twine upload --repository-url https://test.pypi.org/legacy/ dist/* - name: Publish package to PyPI - if: github.ref == 'refs/heads/main' env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/Recipyzer/compile_metadata.py b/Recipyzer/compile_metadata.py index 492cb88..b84f8f0 100644 --- a/Recipyzer/compile_metadata.py +++ b/Recipyzer/compile_metadata.py @@ -1,7 +1,8 @@ import os -import frontmatter +import shutil import urllib.parse from collections import defaultdict +import frontmatter # Base directory for your recipe collection BASE_DIR = 'recipes' @@ -19,6 +20,12 @@ def ensure_dir(directory): if not os.path.exists(directory): os.makedirs(directory) +# Function to clear the index directory +def clear_index_directory(): + if os.path.exists(METADATA_DIR): + shutil.rmtree(METADATA_DIR) + ensure_dir(METADATA_DIR) + # Function to update metadata files with a table format def update_metadata(metadata, base_dir, type_): for key, items in metadata.items(): @@ -124,9 +131,11 @@ def compile_metadata(base_dir): update_metadata(holidays_metadata, HOLIDAYS_DIR, 'holiday') def main(): - print('Compiling metadata...') + print('Clearing the metadata directory...') + clear_index_directory() + print('Compiling the metadata directory...') compile_metadata(BASE_DIR) - print('Metadata compilation complete.') + print('The metadata has been compiled successfully!') # Run the metadata compilation if __name__ == '__main__': diff --git a/setup.py b/setup.py index 3e65bfc..46ca821 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="recipyzer", - version="0.1.0-alpha.2", + version="0.1.0-alpha.3", author="Kane McConnell", description="A toolkit for managing and organizing the Recipyzer recipe repository.", long_description=open('./Recipyzer/README.md', encoding='utf-8').read(),