Publish Python 🐍 distribution 📦 to PyPI #75
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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: 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/ |