Skip to content

Adding call to pbook additional init function (#71) #77

Adding call to pbook additional init function (#71)

Adding call to pbook additional init function (#71) #77

name: publish distributions
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types: [published]
workflow_dispatch:
jobs:
build-and-publish:
name: Build and publish Python distro to (Test)PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install python-build, check-manifest, and twine
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install build check-manifest twine
- name: Check MANIFEST
run: |
check-manifest
- name: Build a wheel and a sdist
run: |
python -m build .
- name: Verify history available for dev versions
run: |
wheel_name=$(find dist/ -iname "*.whl" -printf "%f\n")
if [[ "${wheel_name}" == *"pandamonium-0.1.dev"* ]]; then
echo "python-build incorrectly named built distribution: ${wheel_name}"
echo "python-build is lacking the history and tags required to determine version number"
echo "intentionally erroring with 'return 1' now"
return 1
fi
echo "python-build named built distribution: ${wheel_name}"
- name: Verify the distribution
run: twine check dist/*
- name: List contents of sdist
run: python -m tarfile --list dist/pandamonium-*.tar.gz
- name: List contents of wheel
run: python -m zipfile --list dist/pandamonium-*.whl
- name: Publish distribution 📦 to Test PyPI
# every PR will trigger a push event on master, so check the push event is actually coming from master
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'dguest/pandamonium'
uses: pypa/[email protected]
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
print_hash: true
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'dguest/pandamonium'
uses: pypa/[email protected]
with:
password: ${{ secrets.pypi_password }}
print_hash: true