Skip to content

Deploy to PyPI 📦 #33

Deploy to PyPI 📦

Deploy to PyPI 📦 #33

Workflow file for this run

name: Deploy to PyPI 📦
# trigger deploy_to_pypi workflow once deploy_to_testpypi has successfully completed
on:
workflow_run:
workflows: [Deploy to TestPyPI 📦]
types:
- completed
# allow for workflow to be manually initiated from the Actions tab
workflow_dispatch:
jobs:
build:
name: Deploy to PyPI 📦
runs-on: ubuntu-latest # platform: [ubuntu-latest, macos-latest, windows-latest]
strategy:
matrix:
python-version: [3.8] #deploying using one Python version on 1 runner
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
# install all required modules and dependancies using pip and setup.py installation
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 setup.py install
pip install build
# Build package
- name: Build package
run: |
python -m build
# publish to pypi
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
#sleep for 30 seconds to ensure that distribution package has finised uploading to Test PyPI
- name: Wait / Sleep
uses: jakejarvis/wait-action@master
with:
time: '30s'
# download package of iso3166_2 from PYPI server to ensure it uploaded correctly
- name: Install iso3166_2 from PyPI
run: |
pip install iso3166_2 --upgrade
echo -e "import iso3166_2 as iso3166_2" | python3
echo "iso3166_2 successfully installed"