File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright 2022 FeatureProbe
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ import re
16+ import sys
17+
18+
19+ with open ('featureprobe/__init__.py' , 'r' ) as f :
20+ content = f .read ()
21+ fmt = re .compile (r"__version__ = '(?P<version>.*)'" )
22+ version = fmt .search (content ).groupdict ()['version' ]
23+
24+ tag = sys .argv [1 ].split ('/' )[- 1 ]
25+
26+ with open ('featureprobe/__init__.py' , 'w' ) as f :
27+ version = "__version__ = '%s'" % tag
28+ f .write (re .sub ('__version__ = \' .*\' ' , version , content ))
Original file line number Diff line number Diff line change 4040 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4141 uses : EndBug/add-and-commit@v8.0.2
4242 with :
43- default_author : github_actions
43+ default_author : github_actor
4444 message : " chore: add license header(s)"
4545
4646 - name : Create pull request
7373 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7474 uses : EndBug/add-and-commit@v8.0.2
7575 with :
76- default_author : github_actions
76+ default_author : github_actor
7777 message : " style: format python code (pep8)"
Original file line number Diff line number Diff line change 11name : " Release to PyPI & TestPyPI"
22
33on :
4- push :
5- branches : [ main ]
6-
4+ release :
5+ types :
6+ - released
7+ - prereleased
78
89jobs :
910 build-and-publish :
1920 with :
2021 python-version : ' 3.5'
2122
23+ - name : Set the version metadata to the release tag
24+ run : |
25+ python .github/tools/check_metadata.py ${{ github.ref }}
26+
27+ # - name: PR for bumping version metadata
28+ # uses: peter-evans/create-pull-request@v3
29+ # with:
30+ # author: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
31+ # commit-message: "chore: bump version metadata for ${{ github.ref }}"
32+ # title: "chore: bump version metadata for ${{ github.ref }}"
33+ # body: The version metadata was not updated before release, it has been corrected when building dist, yet please update the code.
34+ # branch: bump-version
35+ # base: ${{ github.event.release.target_commitish }}
36+
2237 - name : Install dependencies
2338 run : |
2439 pip install --upgrade pip
3651 repository_url : https://test.pypi.org/legacy/
3752
3853 - name : Publish to PyPI
39- if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
54+ if : ${{ github.event.action }} == "released"
4055 uses : pypa/gh-action-pypi-publish@release/v1
4156 with :
4257 password : ${{ secrets.PYPI_API_TOKEN }}
Original file line number Diff line number Diff line change 11name : " Tests"
22
33on :
4- push :
5- branches : [ main ]
64 pull_request :
75
86concurrency :
Original file line number Diff line number Diff line change 1515__author__ = 'FeatureProbe'
1616__license__ = 'Apache 2.0'
1717
18- __version__ = '1.0.0-beta'
18+
19+ # PEP440 spec:
20+ # [N!]N(.N)*[{a|b|rc}N][.postN][.devN]
21+ __version__ = 'NO_MANUAL_MAINTENANCE_NEEDED'
22+
1923
2024# --------------- API --------------- #
2125
3943
4044
4145__all__ = [
42- '__version__' ,
43-
4446 # featureprobe.model
4547
4648 'Condition' ,
Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ def _requirements():
3434 'Programming Language :: Python :: 3.10' ,
3535]
3636
37- if 'alpha ' in featureprobe .__version__ :
37+ if 'a ' in featureprobe .__version__ :
3838 pypi_classifiers .append ('Development Status :: 3 - Alpha' )
39- elif 'beta ' in featureprobe .__version__ :
39+ elif 'b' in featureprobe . __version__ or 'rc ' in featureprobe .__version__ :
4040 pypi_classifiers .append ('Development Status :: 4 - Beta' )
4141else :
4242 pypi_classifiers .append ('Development Status :: 5 - Production/Stable' )
You can’t perform that action at this time.
0 commit comments