Skip to content

Simplify github workflow #158

Simplify github workflow

Simplify github workflow #158

Workflow file for this run

name: Build and upload to PyPI
on:
push:
release:
types:
- published
jobs:
build:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-node@v3
with:
node-version: 22
- name: Set version number
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION = \"${GITHUB_REF_NAME:1}\"" > opuscleaner/__about__.py
- name: Build
run: python -m build
- uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/opuscleaner-*.tar.gz
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/opuscleaner-*.whl
run_tests:
needs: [build]
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: Install
run: python3 -m pip install dist/opuscleaner-*.tar.gz
- name: Run runtime unittest
run: python3 -m unittest discover -s test
- name: Run filters unittest
run: python3 -m unittest discover -s opuscleaner/filters
upload_pypi:
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: sdist
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}