Skip to content

allow script to run on main branch #13

allow script to run on main branch

allow script to run on main branch #13

# This workflow builds and validates the Python package distribution and
# uploads it to PyPI if the triggering event was a tag push. When it's a
# scheduled run, it just builds and validates the distribution as a test, but
# does not upload it. The upload uses PyPI trusted publishing, so don't change
# this workflow file's name.
name: Build and publish to PyPI
on:
push:
tags:
- v*
schedule:
- cron: 40 4 * * 1 # every monday at 04:40 UTC
jobs:
build_publish_pypi:
if: ${{ github.repository == 'gboeing/osmnx' }}
name: Build/publish package to PyPI
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
id-token: write
defaults:
run:
shell: bash -elo pipefail {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.*
cache: pip
cache-dependency-path: ./environments/requirements/requirements-packaging.txt
- name: Build and check package
run: |
python -m pip install -r ./environments/requirements/requirements-packaging.txt
python -m validate_pyproject ./pyproject.toml
python -m hatch build --clean
python -m twine check --strict ./dist/*
- name: Publish package to PyPI
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
uses: pypa/gh-action-pypi-publish@release/v1