name: Publish to PyPI on: release: types: [published] workflow_dispatch: inputs: dry_run: description: 'Dry run (don''t actually publish)' type: boolean default: true jobs: pypi: runs-on: ubuntu-latest environment: release permissions: id-token: write contents: read steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install build deps run: pip install build twine - name: Build package run: python -m build - name: Check package run: twine check dist/* - name: Publish to PyPI if: ${{ !inputs.dry_run }} uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_TOKEN }} huggingface: runs-on: ubuntu-latest needs: [pypi] if: ${{ !inputs.dry_run }} steps: - uses: actions/checkout@v4 - name: Upload to HuggingFace env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | pip install huggingface_hub python -c " from huggingface_hub import HfApi api = HfApi() api.upload_folder( repo_id='evolucentai/lexrag', folder_path='.', token='${{ secrets.HF_TOKEN }}' ) print('Uploaded to HuggingFace') "