-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
39 lines (31 loc) · 1.33 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
#!/bin/bash
cd $GITHUB_WORKSPACE
# Install the dependencies of this repo to be able to run the notebook
pip install -r requirements.txt
# Clone the Algorithmia algorithm repository
CI_ALGO_DIR=$INPUT_ALGORITHMIA_ALGONAME"_CI"
rm -rf $CI_ALGO_DIR
if [ -z "$INPUT_ALGORITHMIA_PASSWORD" ]
then
echo "Will clone algorithm repository hosted on Github"
git clone https://"$INPUT_GITHUB_PAT"@"$INPUT_GIT_HOST"/"$INPUT_GITHUB_USERNAME"/"$INPUT_ALGORITHMIA_ALGONAME".git $CI_ALGO_DIR
else
echo "Will clone algorithm repository hosted on Algorithmia"
git clone https://"$INPUT_ALGORITHMIA_USERNAME":"$INPUT_ALGORITHMIA_PASSWORD"@"$INPUT_GIT_HOST"/git/"$INPUT_ALGORITHMIA_USERNAME"/"$INPUT_ALGORITHMIA_ALGONAME".git $CI_ALGO_DIR
fi
if [ -d $INPUT_ALGORITHMIA_ALGONAME ]
then
echo "Will copy and push the contents of $INPUT_ALGORITHMIA_ALGONAME directory to Algorithm repository."
cp -a "$INPUT_ALGORITHMIA_ALGONAME"/. $CI_ALGO_DIR/
else
echo "Could not locate the algorithm directory to copy the contents."
fi
python /src/action_main.py
echo "Switching to the algorithm repo directory to push changes to the Algorithm repo."
cd $CI_ALGO_DIR
git config --global user.name "$INPUT_ALGORITHMIA_USERNAME"
git config --global user.email "$INPUT_ALGORITHMIA_EMAIL"
git status
git add .
git commit -m "Automated deployment via Github CI"
git push