Skip to content

fix(ci): Adapt workflow for Python Semantic Release v7 -> v9 #50

fix(ci): Adapt workflow for Python Semantic Release v7 -> v9

fix(ci): Adapt workflow for Python Semantic Release v7 -> v9 #50

Workflow file for this run

name: CI
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.12
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- run: uv sync
- run: uv run pre-commit run --all-files
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9, "3.10", 3.11, 3.12]
env:
PYTHON: ${{ matrix.python-version }}
OS: ubuntu
steps:
- uses: actions/checkout@v3
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- run: uv sync
- run: uv run pytest --cov=pydantic_ssm_settings
env:
COVERAGE_FILE: coverage/.coverage.linux-py${{ matrix.python-version }}-cN-dN
CONTEXT: linux-py${{ matrix.python-version }}-compiled-no-deps-no
- name: store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
release:
name: Semantic Release
runs-on: ubuntu-latest
concurrency: push
if: github.ref_name == 'main'
needs: [test, lint]
steps:
- uses: actions/checkout@v4
with:
# You must set fetch-depth to 0 when using actions/checkout@v2, since
# Python Semantic Release needs access to the full history to
# determine whether a release should be made.
fetch-depth: 0
- run: pip install packaging
- name: Python Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: steps.release.outputs.released == 'true'
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/[email protected]
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}