Skip to content

Commit 6b6a62f

Browse files
authored
Version control in Publish.yml CI (#610)
version control in Publish.yml CI
1 parent a9996f3 commit 6b6a62f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/Publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
13-
- run: python setup.py bdist_wheel
13+
- run: python setup.py bdist_wheel --python-tag=py3
1414
- name: Publish package
1515
uses: pypa/gh-action-pypi-publish@release/v1
1616
with:

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import re
66
import time
7+
import sys
78

89
from setuptools import find_packages
910
from setuptools import setup
@@ -33,6 +34,10 @@
3334
with open(os.path.join(here, 'brainpy', '__init__.py'), 'r') as f:
3435
init_py = f.read()
3536
version = re.search('__version__ = "(.*)"', init_py).groups()[0]
37+
if len(sys.argv) > 2 and sys.argv[2] == '--python-tag=py3':
38+
version = version
39+
else:
40+
version += '.post{}'.format(time.strftime("%Y%m%d", time.localtime()))
3641

3742
# obtain long description from README
3843
with io.open(os.path.join(here, 'README.md'), 'r', encoding='utf-8') as f:
@@ -44,7 +49,7 @@
4449
# setup
4550
setup(
4651
name='brainpy',
47-
version=version + '.post{}'.format(time.strftime("%Y%m%d", time.localtime())),
52+
version=version,
4853
description='BrainPy: Brain Dynamics Programming in Python',
4954
long_description=README,
5055
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)