forked from maxibor/conda-package-publish-action
-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
executable file
·66 lines (58 loc) · 1.93 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
#!/bin/bash
set -ex
set -o pipefail
install_apt_packages(){
if [ ! -z "${INPUT_ADDITIONAL_APT_PACKAGES}" ]; then
apt-get install -y ${INPUT_ADDITIONAL_APT_PACKAGES}
fi
}
go_to_build_dir() {
if [ ! -z $INPUT_SUBDIR ]; then
cd $INPUT_SUBDIR
fi
}
check_if_meta_yaml_file_exists() {
if [ ! -f meta.yaml ]; then
echo "meta.yaml must exist in the directory that is being packaged and published."
exit 1
fi
}
build_and_test_package(){
if [ ${INPUT_TEST_ALL} = true ]; then
eval conda mambabuild . ${INPUT_CHANNELS} --output-folder .
else
# builds and tests one package, with the specified combination of python and numpy
eval conda mambabuild . ${INPUT_CHANNELS} "--python="${INPUT_TEST_PYVER} "--numpy="${INPUT_TEST_NPVER} --output-folder .
fi
if [ ${INPUT_CONVERT_OSX} = true ]; then
conda convert -p osx-64 linux-64/*.tar.bz2
fi
if [ ${INPUT_CONVERT_WIN} = true ]; then
conda convert -p win-64 linux-64/*.tar.bz2
fi
}
upload_package(){
# upload package if INPUT_PUBLISH is set to true
if [ ${INPUT_PUBLISH} = true ]; then
export ANACONDA_API_TOKEN=$INPUT_ANACONDATOKEN
anaconda upload --label main noarch/*.tar.bz2 || anaconda upload --label main linux-64/*.tar.bz2
if [ ${INPUT_CONVERT_OSX} = true ]; then
if [ ${INPUT_TEST_ALL} = false ]; then
conda convert -p osx-64 linux-64/*.tar.bz2
fi
anaconda upload --label main osx-64/*.tar.bz2
fi
if [ ${INPUT_CONVERT_WIN} = true ]; then
if [ ${INPUT_TEST_ALL} = false ]; then
conda convert -p win-64 linux-64/*.tar.bz2
fi
anaconda upload --label main win-64/*.tar.bz2
fi
fi
}
git config --global --add safe.directory /github/workspace
install_apt_packages
go_to_build_dir
check_if_meta_yaml_file_exists
build_and_test_package
upload_package