Skip to content

Publish Python 🐍 distribution 📦 to PyPI #84

Publish Python 🐍 distribution 📦 to PyPI

Publish Python 🐍 distribution 📦 to PyPI #84

Workflow file for this run

name: Publish Python 🐍 distribution 📦 to PyPI
on:
release:
types: [created]
jobs:
tests:
name: Linting and running tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start databases
working-directory: ./sample-apps/databases
run: docker compose up --build -d
- name: Add local.aikido.io to /etc/hosts
run: |
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
- name: Installation
run: make dev_install
- name: Run Pylint
run: |
poetry run pylint --fail-under=9 --rcfile=.pylintrc aikido_zen/
pylint_exit_code=$?
if [ $pylint_exit_code -ne 0 ]; then
echo "Pylint check failed. Please fix the issues."
exit 1
fi
- name: Run Black Check
run: |
poetry run black --check --diff aikido_zen/
black_exit_code=$?
if [ $black_exit_code -ne 0 ]; then
echo "Black check failed. Please run 'black .' to format the code."
exit 1
fi
- name: Run tests
run: |
make test
build:
name: Build distribution 📦 and Publish to PyPI
needs:
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry
- name: Set the version for this release
run: |
TAG_NAME=${GITHUB_REF##*/}
make replace_version version=${TAG_NAME#v}
- name: Download binaries & build
run: make build
- name: Publish to PyPI
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/