diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index efa6c64..dc575ee 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -124,39 +124,73 @@ jobs: run: | pytest tests --ignore=tests/hypothesis - publish: - if: "github.event_name == 'push' && github.repository == 'cleder/pygeoif'" - needs: [cpython, static-tests, pypy, hypothesis-tests] - name: Build and publish to PyPI and TestPyPI + build-and-check-package: + name: Build & inspect our package. runs-on: ubuntu-latest - environment: release + steps: + - uses: actions/checkout@v4 + - uses: hynek/build-and-inspect-python-package@v2 + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + - uses: hynek/build-and-inspect-python-package@v2 + - uses: actions/setup-python@v5 + with: + python-version-file: "pyproject.toml" + - name: Check with pyroma + run: | + uv tool run pyroma . + - name: Check tag name + if: >- + github.event_name == 'push' && + startsWith(github.ref, 'refs/tags') + run: | + uv tool run vercheck $GITHUB_REF_NAME pygeoif/about.py + + + test-publish: + if: >- + github.event_name == 'push' && + github.repository == 'cleder/pygeoif' && + startsWith(github.ref, 'refs/tags') + needs: [build-and-check-package, pypy, test-coverage, hypothesis-tests, cpython, static-tests] + name: Test install on TestPyPI + runs-on: ubuntu-latest + environment: test-release permissions: id-token: write steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 + - name: Download packages built by build-and-check-package + uses: actions/download-artifact@v4 with: - python-version: 3.12 - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - - name: Publish distribution 📦 to Test PyPI for tags - if: startsWith(github.ref, 'refs/tags') + name: Packages + path: dist + + - name: Upload package to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ + + publish: + if: >- + github.event_name == 'push' && + github.repository == 'cleder/pygeoif' && + github.ref == 'refs/heads/main' + needs: [build-and-check-package, pypy, test-coverage, hypothesis-tests, cpython, static-tests] + name: Publish to PyPI + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Download packages built by build-and-check-package + uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + - name: Publish distribution 📦 to PyPI for push to main - if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: pypa/gh-action-pypi-publish@release/v1 + ...