diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 144f780..13b2fbb 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,6 +1,7 @@ -# This workflow will upload a Python Package using flit when a release is -# created. For more information see: -# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +# This workflows will upload a Python Package when a release is created. +# For more information see: +# - https://docs.pypi.org/trusted-publishers/adding-a-publisher/ +# - https://github.com/pypa/gh-action-pypi-publish name: Upload Python Package @@ -12,23 +13,25 @@ jobs: deploy: runs-on: ubuntu-latest + permissions: + id-token: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.x' - - name: Install dependencies + + - name: Build package run: | + set -vxeuo pipefail python -m pip install --upgrade pip - pip install wheel twine setuptools - - name: Build and publish - env: - TWINE_USERNAME: __token__ - # The PYPI_PASSWORD must be a pypi token with the "pypi-" prefix with sufficient permissions to upload this package - # https://pypi.org/help/#apitoken - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | + pip install wheel setuptools python setup.py sdist bdist_wheel - twine upload dist/* + + - name: Publish wheels to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: ./dist/ diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d7ba9e2..ee95bbe 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,10 +6,13 @@ on: jobs: build: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + strategy: matrix: host-os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.7", "3.8", "3.9"] + python-version: ["3.8", "3.9", "3.10"] fail-fast: false runs-on: ${{ matrix.host-os }} @@ -19,7 +22,7 @@ jobs: shell: bash -l {0} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v2 with: