Spaces:
Running
Running
| name: publish | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| pypi: | |
| if: "!github.event.release.prerelease" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python: ["3.10"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| architecture: x64 | |
| - name: Cache python modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel twine --upgrade | |
| - name: Get release tag | |
| id: release_tag | |
| run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: Build and publish | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| VERSION: ${{ env.VERSION }} | |
| run: | | |
| BUILD_VERSION=$VERSION python setup.py sdist bdist_wheel | |
| twine check dist/* | |
| twine upload dist/* | |
| pypi-check: | |
| needs: pypi | |
| if: "!github.event.release.prerelease" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python: ["3.10"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| architecture: x64 | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install python-doctr | |
| python -c "from importlib.metadata import version; print(version('python-doctr'))" | |