Skip to content

Publish to PyPI

Publish to PyPI #7

name: CLI Docker Image
on:
release:
types: [published]
permissions:
contents: read
packages: write
jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build the package
run: |
cd CLI
python -m build --outdir dist
- name: Verify dist directory contents
run: |
cd $GITHUB_WORKSPACE
dist_dir=$(find . -type d -name dist)
if [ -z "$(ls -A $dist_dir)" ]; then
echo "Error: dist directory is empty."
exit 1
else
echo "dist directory contains:"
ls -R $dist_dir
fi
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}