Migrate as much of the setup.cfg file to the pyproject.toml file as w… #41
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: PyPI | |
on: | |
push: | |
branches: | |
- main | |
- auto-release | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name for pull requests | |
# or the commit hash for any other events. | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build distributions | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install build dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build distributions | |
run: | | |
python -m build | |
- name: Check the sdist installs and imports | |
run: | | |
mkdir -p test-sdist | |
cd test-sdist | |
python -m venv venv-sdist | |
venv-sdist/bin/python -m pip install ../dist/etuples-*.tar.gz | |
venv-sdist/bin/python -c "import etuples; print(etuples.__version__)" | |
- name: Check the wheel installs and imports | |
run: | | |
mkdir -p test-wheel | |
cd test-wheel | |
python -m venv venv-wheel | |
venv-wheel/bin/python -m pip install ../dist/etuples-*.whl | |
venv-wheel/bin/python -c "import etuples; print(etuples.__version__)" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: dist/* | |
upload_pypi: | |
name: Upload to PyPI on release | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_secret }} |