Skip to content

Commit 7313f1f

Browse files
committed
Add a numeric field for version info
And setup auto publication
1 parent d7df790 commit 7313f1f

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

.github/workflows/publish.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
push:
3+
tags:
4+
- '*'
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
pypi-publish:
10+
name: Upload release to PyPI
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/inersphinx_registry
15+
permissions:
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build
28+
- name: Install built wheel
29+
run: pip install dist/*
30+
- name: Build package
31+
run: python -m build
32+
- name: Echo current tag
33+
run: echo ${{ github.ref }}
34+
- name: Get package version
35+
run: |
36+
PACKAGE_VERSION=$(python -c 'import matplotlib_inline; print(matplotlib_inline.__version__)')
37+
echo "Package version: $PACKAGE_VERSION"
38+
39+
- name: Check tag and package version match
40+
run: |
41+
if [ "$GITHUB_REF" != "refs/tags/$PACKAGE_VERSION" ]; then
42+
echo "Tag and package version do not match. Aborting."
43+
exit 1
44+
fi
45+
# - name: Publish package
46+
# uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc
47+

matplotlib_inline/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
from . import backend_inline, config # noqa
2-
__version__ = "0.1.7" # noqa
2+
3+
version_info = (0, 1, 7)
4+
__version__ = '.'.join(str(s) for s in version_info) # noqa

0 commit comments

Comments
 (0)