Skip to content

Workflow to publish wheels to PyPI #3

Workflow to publish wheels to PyPI

Workflow to publish wheels to PyPI #3

Workflow file for this run

name: Workflow to publish wheels to PyPI
on:
release:
types:
- released
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout pyse
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tool
run: |
python -m pip install --upgrade pip
python -m pip install hatch
- name: Build
run: |
hatch build
- name: Save wheel
uses: actions/upload-artifact@v4
with:
path: dist/*
if-no-files-found: error
retention-days: 7
test:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- name: Checkout pyse
uses: actions/checkout@v4
- name: Make dist directory
run: mkdir -p dist
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: dist
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tools
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov
# pytest-cov needed as config includes --cov
- name: Install PySE
run: |
pip install dist/*.whl
- name: Remove source, run tests on installed package
run: |
rm -rf sourcefinder
pytest --cov= test
publish:
# isolate from test, to prevent partial uploads
needs: test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Make dist directory
run: mkdir -p dist
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: dist
- name: Publish to PyPI using trusted publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
# repository-url: https://test.pypi.org/legacy/
packages-dir: dist/
# skip-existing: true
# verify-metadata: false