Skip to content

publish python packages to pypi in ci #51

publish python packages to pypi in ci

publish python packages to pypi in ci #51

name: Test, visualize, and build calitp-data-infra
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/build-calitp-data-infra.yml'
- 'packages/calitp-data-infra/calitp_data_infra/**'
pull_request:
paths:
- '.github/workflows/build-calitp-data-infra.yml'
- 'packages/calitp-data-infra/calitp_data_infra/**'
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: packages/calitp-data-analysis
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: google-github-actions/setup-gcloud@v0
with:
export_default_credentials: true
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Run checks
run: |
curl -sSL https://install.python-poetry.org | python -
poetry install
poetry run mypy .
poetry run pytest
poetry build
env:
CALITP_BUCKET__AIRTABLE: gs://this-does-not-exist
CALITP_BUCKET__GTFS_DOWNLOAD_CONFIG: gs://this-does-not-exist
CALITP_BUCKET__GTFS_SCHEDULE_RAW: gs://this-does-not-exist
CALITP_BUCKET__GTFS_RT_RAW: gs://this-does-not-exist
- 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.PYPI_CALITP_DATA_INFRA_TOKEN }}
- if: ${{ github.ref == 'refs/heads/main' }}
run: poetry publish --skip-existing
env:
POETRY_TEST_PYPI_TOKEN_PYPI: ${{ secrets.TEST_PYPI_CALITP_DATA_INFRA_TOKEN }}