Skip to content

ci: Bump lower Python to 3.9 #8

ci: Bump lower Python to 3.9

ci: Bump lower Python to 3.9 #8

Workflow file for this run

name: Release
#
# Releases new version of this project.
#
# Make sure to prepare project for a new release (see docs for more). After
# publishing package a GitHub release is drafted. Will fail if the the version
# is already available on PyPI.
#
# Project page on PyPI: https://pypi.org/project/prometheus-fastapi-instrumentator
#
on:
push:
tags:
- v*.*.*
permissions:
contents: write
env:
poetry_version: "2.0.1"
python_version: "3.12"
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# ------------------------------------------------------------------------
# Python & Poetry.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Cache Poetry installation
uses: actions/cache@v4
with:
path: |
~/.local/bin/poetry
~/.local/share/pypoetry
key: |-
${{ runner.os }}-poetry-installation-${{ env.python_version }}-${{ env.poetry_version }}-0
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python -
env:
POETRY_VERSION: ${{ env.poetry_version }}
# ------------------------------------------------------------------------
# Publishing & draft release.
- name: Check version equality between Poetry and __version__
run: |
pattern="__version__ = \"$(poetry version --short)\""
if ! grep -q -R -F --include="__init__.py" "$pattern" src; then
echo "::error::No version equality between Poetry and __version__."; exit 1
fi
- name: Check version equality between Poetry and Git tag
run: |
poetry_version=$(poetry version --short)
git_tag=${GITHUB_REF#refs/*/}
if [[ "v$poetry_version" != "$git_tag" ]]; then
echo "::error::No version equality between Poetry and Git tag."; exit 1
fi
- name: Publish to PyPI with Poetry
run: poetry publish --build -n -u __token__ -p "$TOKEN"
env:
TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: Draft GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true