Merge "Revert "Fix rtd verify job choosing strategy""
[releng/global-jjb.git] / shell / pypi-upload.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2019 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> pypi-upload.sh"
12
13 # Script to publish Python distributions from a folder
14 # to the PyPI repository in $REPOSITORY which must be a
15 # key in the .pypirc file
16
17 # Ensure we fail the job if any steps fail.
18 set -eu -o pipefail
19
20 virtualenv -p python3 /tmp/pypi
21 PATH=/tmp/pypi/bin:$PATH
22
23 pip install twine
24 echo "INFO: cd to tox-dir $TOX_DIR"
25 cd "$WORKSPACE/$TOX_DIR"
26 cmd="twine upload -r $REPOSITORY dist/*"
27 if $DRY_RUN; then
28     echo "INFO: dry-run is set, echoing command only"
29     echo $cmd
30 else
31     echo "INFO: uploading distributions"
32     $cmd
33 fi
34 echo "---> pypi-upload.sh ends"