Fixing hosting issue in docs-preview #116
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to PyPI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| release: | |
| types: [published] | |
| jobs: | |
| # Setup build separate from publish for added security | |
| # See https://github.com/pypa/gh-action-pypi-publish/issues/217#issuecomment-1965727093 | |
| build: | |
| runs-on: ubuntu-latest | |
| # Environment is encouraged for increased security | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4 | |
| with: | |
| # This fetch element is only important if you are use SCM based | |
| # versioning (that looks at git tags to gather the version). | |
| # setuptools-scm needs tags to form a valid version number | |
| fetch-tags: true | |
| - name: Setup Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| # You can modify what version of Python you want to use for your release | |
| python-version: "3.11" | |
| - name: Install hatch | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install hatch | |
| - name: Build package using Hatch | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install hatch hatchling | |
| hatch build --clean | |
| echo "" | |
| echo "Generated files:" | |
| ls -lh dist/ | |
| # Store an artifact of the build to use in the publish step below | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| if-no-files-found: error | |
| publish: | |
| name: >- | |
| Publish Python 🐍 distribution 📦 to PyPI | |
| # Only publish to PyPI with a release trigger in your repository. | |
| if: github.repository_owner == 'Eligoze75' && github.event_name == 'release' | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| # Environment required here for trusted publisher | |
| environment: | |
| name: pypi | |
| # Modify the url to be the name of your package | |
| url: https://pypi.org/p/autoeda | |
| permissions: | |
| id-token: write # this permission is mandatory for PyPI publishing | |
| steps: | |
| - name: Download dists | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| merge-multiple: true | |
| - name: Publish package to PyPI | |
| # Only publish to real PyPI on release. This action uses sigstore for additional security. | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e #v1.13.0 |