Skip to content

tutorial 5 included #245

tutorial 5 included

tutorial 5 included #245

# Deploy package to PyPi when a new VERSION is release to the main branch
# Author: Matt Clifford <[email protected]>
# License: BSD 3-Clause License
name: Upload Python Package to PyPi
on:
push:
branches:
- main
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Version numbers
run: |
echo "code_version=$(./dev_resources/scripts/get_local_version.py)" >> $GITHUB_ENV
echo "pypi_version=$(./dev_resources/scripts/get_latest_pypi_version.py)" >> $GITHUB_ENV
- name: Set up Python
if: env.code_version != env.pypi_version
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install base python deps
if: env.code_version != env.pypi_version
run: |
python -m pip install --upgrade pip
pip install packaging
- name: Build package
if: env.code_version != env.pypi_version
run: |
pip install build
python -m build
- name: Publish package
if: env.code_version != env.pypi_version
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}