Workflows wtf #167
Workflow file for this run
This file contains 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: 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: Install build | |
run: python -m pip install build | |
- 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: build-output | |
path: dist/opuscleaner-*.* | |
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: build-output | |
path: dist | |
- name: Install | |
run: python3 -m pip install dist/opuscleaner-*.whl | |
- 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: build-output | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.5.0 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |