Chore: Upgrade Jenkins-job-builder to 6.3.0
[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 # shellcheck disable=SC1090
21 source ~/lf-env.sh
22
23 # Version controlled by JJB_VERSION
24 lf-activate-venv setuptools==65.7.0 urllib3~=1.26.15 twine wheel readline
25
26
27 echo "INFO: cd to tox-dir $TOX_DIR"
28 cd "$WORKSPACE/$TOX_DIR"
29
30 cmd="twine upload -r $REPOSITORY dist/*"
31 if $DRY_RUN; then
32     echo "INFO: dry-run is set, echoing command only"
33     echo "$cmd"
34 else
35     echo "INFO: uploading distributions to repo $REPOSITORY"
36     $cmd
37     # emit message and files on single line for release-job
38     # shellcheck disable=SC2046
39     echo "INFO: successfully uploaded distributions: " $(ls dist)
40 fi
41
42 echo "---> pypi-upload.sh ends"