File tree Expand file tree Collapse file tree 1 file changed +77
-1
lines changed Expand file tree Collapse file tree 1 file changed +77
-1
lines changed Original file line number Diff line number Diff line change 64
64
docker :
65
65
- image : circleci/python:3.6
66
66
67
-
68
67
steps :
69
68
- checkout
70
69
- run :
91
90
- dist
92
91
- version.txt
93
92
93
+ deploy_test_pypi : &deploy_template
94
+ # Job to deploy on test environment
95
+ # Requires dist files under workspace/dist
96
+ docker :
97
+ - image : circleci/python:3.6
98
+
99
+ steps :
100
+
101
+ - attach_workspace :
102
+ at : workspace
103
+
104
+ - run :
105
+ name : Create VEnv with tools
106
+ command : |
107
+ python3 -m venv venv
108
+ . venv/bin/activate
109
+ pip install -U pip setuptools twine
110
+
111
+ - run :
112
+ name : Upload to PyPI
113
+ command : |
114
+ . venv/bin/activate
115
+ export TWINE_USERNAME="${PYPI_TEST_USERNAME}"
116
+ export TWINE_PASSWORD="${PYPI_TEST_PASSWORD}"
117
+ echo "Uploading to test.pypi.org"
118
+ ./venv/bin/twine upload --repository-url https://test.pypi.org/legacy/ workspace/dist/*`cat workspace/version.txt`*
119
+
120
+ install_test_pypi :
121
+ # Try to install from test-pip
122
+ docker :
123
+ - image : circleci/python:3.6
124
+
125
+ steps :
126
+ - attach_workspace :
127
+ at : workspace
128
+
129
+ - run :
130
+ name : Create virtual-environment
131
+ command : |
132
+ python3 -m venv venv
133
+ . venv/bin/activate
134
+
135
+ - run :
136
+ name : Install from pip
137
+ # Try to install the same version from PyPI
138
+ command : |
139
+ . venv/bin/activate
140
+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple flask-log-request-id==`cat workspace/version.txt`
141
+ pip freeze | grep -i flask-log-request-id
142
+
94
143
workflows :
95
144
version : 2
96
145
test_build_deploy :
@@ -101,3 +150,30 @@ workflows:
101
150
requires :
102
151
- test-3.6
103
152
- test-3.5
153
+
154
+ - deploy_test_pypi :
155
+ filters :
156
+ branches :
157
+ only :
158
+ - staging
159
+ requires :
160
+ - build
161
+ - install_test_pypi :
162
+ requires :
163
+ - deploy_test_pypi
164
+
165
+
166
+ - request_permission_for_public_pypi :
167
+ type : approval
168
+ requires :
169
+ - build
170
+ filters :
171
+ tags :
172
+ only :
173
+ - /^v[\d\.]+$/
174
+ branches :
175
+ only : master
176
+
177
+ - deploy_pypi :
178
+ requires :
179
+ - request_permission_for_public_pypi
You can’t perform that action at this time.
0 commit comments