Skip to content

v1.6.43; adds some logging to RCMG to better understand the effect of… #102

v1.6.43; adds some logging to RCMG to better understand the effect of…

v1.6.43; adds some logging to RCMG to better understand the effect of… #102

Workflow file for this run

name: Publish Python 🐍 distribution 📦 to PyPI
on:
push:
tags:
- "**"
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Verify tag
run: |
# Extract the version from pyproject.toml
VERSION=$(grep -oP 'version\s*=\s*"\K[^"]+' pyproject.toml)
echo "Version in pyproject.toml: $VERSION"
echo "Tag: ${{ github.ref_name }}"
# Check if the tag matches the expected format (vX.Y.Z)
if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Tag '${{ github.ref_name }}' does not match the expected format (vX.Y.Z)"
exit 1
fi
# Check if the tag matches the version in pyproject.toml
if [[ "${{ github.ref_name }}" != "v$VERSION" ]]; then
echo "Error: Tag '${{ github.ref_name }}' does not match version '$VERSION' in pyproject.toml"
exit 1
fi
- name: Clean dist directory
run: rm -rf dist/
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Verify version in built artifacts
run: |
ls dist/
for file in dist/*; do
echo "Checking version in $file"
if [[ "$file" == *.whl ]]; then
unzip -p "$file" *.dist-info/METADATA | grep Version
else
# Extract the PKG-INFO file from the source distribution
tar -xzf "$file" --wildcards --no-anchored '*/PKG-INFO' -O | grep Version
fi
done
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/imt-ring # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4.1.7
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1