This repository was archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-push-it
More file actions
executable file
·57 lines (45 loc) · 1.47 KB
/
build-and-push-it
File metadata and controls
executable file
·57 lines (45 loc) · 1.47 KB
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
#!/usr/bin/env bash
set -e
# We set the conda install dir.
condaInstallDirs=(
"${HOME}/miniconda"
"${HOME}/miniconda3"
"/opt/miniconda"
"/opt/miniconda3"
)
# We get the package name to build.
pkgName="${1,,}"
# We get the version to use.
pkgVersion="${2,,}"
# We set the build dir.
# We set the build output dir.
buildOutputDir="${CONDA_BUILD_DIR}/conda_pkg"
for condaInstallDir in ${condaInstallDirs[@]}
do
if [[ -f ${condaInstallDir}/etc/profile.d/conda.sh ]]
then
source ${condaInstallDir}/etc/profile.d/conda.sh
break
fi
done
hash conda
if [[ ! -f "meta.yaml" ]]
then
echo "Could not find meta.yaml."
exit 1
fi
sed -i -r "s/(\{%\s+set\s+name\s+=\s+\")(.*)(\"\s+%\})/\1${pkgName}\3/" "meta.yaml"
sed -i -r "s/(\{%\s+set\s+version\s+=\s+\")(.*)(\"\s+%\})/\1${pkgVersion}\3/" "meta.yaml"
# We create a new environment
conda create -y -q -n build-environment python="${PYTHON_VERSION}"
# We activate the newly created environment
conda activate build-environment
# We start to install everything needed (if they are not installed.)
conda install -q -y anaconda-client conda-build conda-verify
# No we build the package we have to upload
conda-build -c pyfunceble --no-force-upload --no-anaconda-upload --output-folder="${buildOutputDir}" "${@:3}" "${CONDA_BUILD_DIR}"
for file in $(find ${buildOutputDir}/noarch -name '*.tar.bz2')
do
# Finally, we upload everything.
anaconda -t "${ANACONDA_TOKEN}" upload --skip-existing ${file}
done