Skip to content

Workflow file for this run

name: Build and Publish Wheels
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
environment: ratelimit-io-pypi-token
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check if commit message is a release version
id: check_release
run: |
if [[ ! "${{ github.event.head_commit.message }}" =~ ^(100|[1-9]?[0-9])\.(100|[1-9]?[0-9])\.(100|[1-9]?[0-9])$ ]]; then
echo "This is not a release commit. Skipping build and publish steps."
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install Poetry
run: |
curl -sSL "https://install.python-poetry.org" | python - --version 1.8.5
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Configure Poetry with PyPI token
env:
POETRY_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $POETRY_TOKEN
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install -U pip
poetry install
- name: Build and Publish to PyPI
env:
POETRY_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
poetry publish --build