Skip to content

publish python packages to pypi in ci #90

publish python packages to pypi in ci

publish python packages to pypi in ci #90

name: Test, visualize, and build calitp-map-utils
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/build-calitp-map-utils.yml'
- 'apps/maps/calitp_map_utils/**'
pull_request:
paths:
- '.github/workflows/build-calitp-map-utils.yml'
- 'apps/maps/calitp_map_utils/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
check_and_build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/maps
steps:
- uses: actions/checkout@v3
- run: sudo apt-get install -y libgraphviz-dev graphviz-dev
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: |
curl -sSL https://install.python-poetry.org | python -
poetry install
poetry run mypy calitp_map_utils
poetry run pytest --spec
poetry build
env:
CALITP_MAP_APP_URL: https://embeddable-maps.calitp.org/
- if: ${{ github.ref != 'refs/heads/main' }}
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi $POETRY_TEST_PYPI_TOKEN_PYPI
poetry publish -r test-pypi --skip-existing
env:
POETRY_TEST_PYPI_TOKEN_PYPI: ${{ secrets.TEST_PYPI_CALITP_MAP_UTILS_TOKEN }}
- if: ${{ github.ref == 'refs/heads/main' }}
run: poetry publish --skip-existing
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_CALITP_MAP_UTILS_TOKEN }}