From 7313f1fe666869db6d3f8bf492854dad6b333c47 Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Tue, 10 Dec 2024 11:55:43 +0100 Subject: [PATCH] Add a numeric field for version info And setup auto publication --- .github/workflows/publish.yml | 47 +++++++++++++++++++++++++++++++++++ matplotlib_inline/__init__.py | 4 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e99084a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,47 @@ +on: + push: + tags: + - '*' +permissions: + contents: read + +jobs: + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/inersphinx_registry + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Install built wheel + run: pip install dist/* + - name: Build package + run: python -m build + - name: Echo current tag + run: echo ${{ github.ref }} + - name: Get package version + run: | + PACKAGE_VERSION=$(python -c 'import matplotlib_inline; print(matplotlib_inline.__version__)') + echo "Package version: $PACKAGE_VERSION" + + - name: Check tag and package version match + run: | + if [ "$GITHUB_REF" != "refs/tags/$PACKAGE_VERSION" ]; then + echo "Tag and package version do not match. Aborting." + exit 1 + fi + # - name: Publish package + # uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc + diff --git a/matplotlib_inline/__init__.py b/matplotlib_inline/__init__.py index dce942f..10b3c97 100644 --- a/matplotlib_inline/__init__.py +++ b/matplotlib_inline/__init__.py @@ -1,2 +1,4 @@ from . import backend_inline, config # noqa -__version__ = "0.1.7" # noqa + +version_info = (0, 1, 7) +__version__ = '.'.join(str(s) for s in version_info) # noqa