Skip to content

Publish to PyPI

Publish to PyPI #2

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [created]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: poetry install
- name: Run tests
run: |
# Only run unit tests that don't start the monitor
poetry run pytest tests/test_database.py tests/test_types.py \
-v --cov=hyperliquid_monitor --cov-report=term-missing
publish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Verify tag version matches package version
run: |
# Extract version from pyproject.toml
PACKAGE_VERSION=$(poetry version -s)
# Remove 'v' prefix from git tag if present
TAG_VERSION=${GITHUB_REF#refs/tags/}
TAG_VERSION=${TAG_VERSION#v}
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- name: Build and publish
run: |
poetry build
poetry publish