File tree 1 file changed +36
-11
lines changed
1 file changed +36
-11
lines changed Original file line number Diff line number Diff line change 1
- # PowerAPI CircleCI 2.0 configuration file
2
- version : 2
1
+ # PowerAPI CircleCI configuration file
2
+ version : 2.1
3
3
jobs :
4
4
build :
5
5
docker :
@@ -43,38 +43,63 @@ jobs:
43
43
publish-release :
44
44
docker :
45
45
- image : circleci/python:3.7
46
+
46
47
steps :
47
48
- checkout
48
49
49
50
- run :
50
- name : create venv and verify git tag vs. version
51
+ name : check git tag with package version
52
+ command : |
53
+ check_git_tag_with_package_version () {
54
+ tag_version=${CIRCLE_TAG#*v}
55
+ pkg_version=$(python3 -c "import powerapi; print(powerapi.__version__)" 2>/dev/null || echo "error")
56
+ if [ "$tag_version" = "$pkg_version" ]; then
57
+ return 0
58
+ fi
59
+ return 1
60
+ }
61
+ check_git_tag_with_package_version
62
+
63
+ - run :
64
+ name : prepare environment
51
65
command : |
52
66
python3 -m venv venv
53
67
. venv/bin/activate
54
68
pip install --upgrade pip
55
69
pip install --upgrade twine
56
- python setup.py verify
57
70
58
71
- run :
59
- name : generate package and upload it
72
+ name : init .pypirc
73
+ command : |
74
+ echo -e "[pypi]" >> ~/.pypirc
75
+ echo -e "username = powerapi" >> ~/.pypirc
76
+ echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
77
+
78
+ - run :
79
+ name : generate package
60
80
command : |
61
81
python3 setup.py sdist bdist_wheel
62
- . venv/bin/activate
63
- twine upload -u powerapi -p $PYPI_PASSWORD dist/*
64
-
65
82
83
+ - run :
84
+ name : upload to pypi
85
+ command : |
86
+ . venv/bin/activate
87
+ twine upload dist/*
66
88
67
89
workflows :
68
90
version : 2
69
- main :
91
+ build-n-publish :
70
92
jobs :
71
93
- build :
72
94
filters :
73
95
tags :
74
- ignore : /v.*/
96
+ only : /.*/
97
+
75
98
- publish-release :
99
+ requires :
100
+ - build
76
101
filters :
77
102
branches :
78
103
ignore : /.*/
79
104
tags :
80
- only : /v.*/
105
+ only : /^ v.*/
You can’t perform that action at this time.
0 commit comments