Skip to content

Commit

Permalink
Add a numeric field for version info
Browse files Browse the repository at this point in the history
And setup auto publication
  • Loading branch information
Carreau committed Dec 10, 2024
1 parent d7df790 commit 0d2dcc4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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/project/matplotlib-inline
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

4 changes: 3 additions & 1 deletion matplotlib_inline/__init__.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0d2dcc4

Please sign in to comment.