forked from scientific-python/upload-nightly-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
42 lines (32 loc) · 1.06 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
#!/bin/bash
# fail on undefined variables
set -u
# Prevent pipe errors to be silenced
set -o pipefail
# Exit if any command exit as non-zero
set -e
# enable trace mode (print what it does)
set -x
# get the anaconda token from the github secrets
#
# this is to prevent accidental uploads
echo "Getting anaconda token from github secrets..."
ANACONDA_ORG="scientific-python-nightly-wheels"
ANACONDA_TOKEN="$INPUT_ANACONDA_NIGHTLY_UPLOAD_TOKEN"
# if the ANACONDA_TOKEN is empty, exit with status -1
# this is to prevent accidental uploads
if [ -z "$ANACONDA_TOKEN" ]; then
echo "ANACONDA_TOKEN is empty , exiting..."
exit -1
fi
# install anaconda-client
echo "Installing anaconda-client..."
conda install -y anaconda-client -c conda-forge
# trim trailing slashes from $INPUT_ARTIFACTS_PATH
INPUT_ARTIFACTS_PATH="${INPUT_ARTIFACTS_PATH%/}"
# debug, print env
env
# upload wheels
echo "Uploading wheels to anaconda.org..."
anaconda -t $ANACONDA_TOKEN upload --force -u "$ANACONDA_ORG" "$INPUT_ARTIFACTS_PATH"/*.whl
echo "Index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"