-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathentrypoint.sh
executable file
·82 lines (69 loc) · 2.24 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash -l
# Publish to the PyPI testing instance URL if the env var
# PYPI_TEST is set to a non-empty value, otherwise publish
# to the main index.
URL_ARG=""
if [[ "${PYPI_TEST}" != "" ]]; then
echo -e "\n----------------------------------------------------------------"
echo "PYPI_TEST var set. Will attempt to publish to the PyPI"
echo "testing instance."
echo -e "----------------------------------------------------------------"
URL_ARG="--repository-url https://test.pypi.org/legacy/"
fi
if [[ "${PYPI_USERNAME_OVERRIDE}" != "" ]]; then
echo -e "\n----------------------------------------------------------------"
echo "PYPI_USERNAME_OVERRIDE var set for this repository."
echo -e "----------------------------------------------------------------"
TWINE_USERNAME=$PYPI_USERNAME_OVERRIDE
else
TWINE_USERNAME=$PYPI_USERNAME_STSCI_MAINTAINER
fi
export TWINE_USERNAME
if [[ "${PYPI_PASSWORD_OVERRIDE}" != "" ]]; then
echo -e "\n----------------------------------------------------------------"
echo "PYPI_PASSWORD_OVERRIDE var set for this repository."
echo -e "----------------------------------------------------------------"
TWINE_PASSWORD=$PYPI_PASSWORD_OVERRIDE
else
TWINE_PASSWORD=$PYPI_PASSWORD_STSCI_MAINTAINER
fi
export TWINE_PASSWORD
REF=$GITHUB_REF
echo "GITHUB_REF=${REF}"
PYTHON=$(which python3.6)
echo "PYTHON=${PYTHON}"
PIP="${PYTHON} -m pip"
echo "PIP=${PIP}"
GCC=$(which gcc)
echo "GCC=${GCC}"
GIT=$(which git)
echo "GIT=${GIT}"
/usr/bin/python3 --version
/usr/bin/gcc --version
$PYTHON --version
$GIT fetch -t
$GIT tag
printf "Install package\n\n"
$PIP install .
printf "Install publication deps\n\n"
$PIP install twine semver pep517
# Validate the version
$PYTHON /validate_version.py $REF
printf "Prepare for publication...\n\n"
$GIT clean -fxd
retval=1
if [[ -e pyproject.toml ]]; then
echo "Found a pyproject.toml file"
grep "build-backend" pyproject.toml
retval=$?
fi
if [[ $retval -eq 0 ]]; then
echo -e "\n\nDetected a PEP517-compatible project..."
$PYTHON -m pep517.build --source .
else
echo -e "\n\nBuilding sdist via setup.py..."
$PYTHON setup.py build sdist --format=gztar
fi
TWINE=$(which twine)
printf "Publish...\n\n"
$TWINE upload $URL_ARG dist/*