forked from scientific-python/upload-nightly-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.sh
52 lines (42 loc) · 1.43 KB
/
cmd.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
#!/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 from lock file
echo "Installing anaconda-client from upload-nightly-action conda-lock lock file..."
micromamba create \
--yes \
--name upload-nightly-action \
--file /conda-lock.yml
# 'micromamba' is running as a subprocess and can't modify the parent shell.
# Thus you must initialize your shell before using activate and deactivate.
eval "$(micromamba shell hook --shell bash)"
micromamba activate upload-nightly-action
# 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 --token "${ANACONDA_TOKEN}" upload \
--force \
--user "${ANACONDA_ORG}" \
"${INPUT_ARTIFACTS_PATH}"/*.whl
echo "Index: https://pypi.anaconda.org/${ANACONDA_ORG}/simple"