Skip to content

Merge pull request #66 from SWR-MoIP/dependabot/pip/all-21b2ce5639 #283

Merge pull request #66 from SWR-MoIP/dependabot/pip/all-21b2ce5639

Merge pull request #66 from SWR-MoIP/dependabot/pip/all-21b2ce5639 #283

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- 'v*' # Trigger on version tags like v1.2.3
pull_request_target:
branches:
- main
permissions:
contents: write
jobs:
# 1️⃣ Test Job
test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --with dev,test
- name: Run tests
run: poetry run pytest
# 2️⃣ Release Job (Uses Prebuilt Package)
release:
name: Release / Publish to PyPI
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --without test,dev
- name: Clean dist folder
run: rm -rf dist/
- name: Configure Poetry and Set Version
run: |
git fetch --tags
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=$(poetry version --short)
echo "Stable version for release: $VERSION"
elif [[ "${GITHUB_REF}" == refs/heads/main ]]; then
VERSION="$(poetry version --short).dev${{ github.run_number }}"
echo "Development version (main): $VERSION"
poetry version "$VERSION"
else
VERSION="$(poetry version --short).dev${{ github.run_number }}"
echo "Development version (branch): $VERSION"
poetry version "$VERSION"
fi
- name: Build the package
run: poetry build
- name: Publish to PyPI
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}"
poetry publish