Skip to content

Commit 50ea158

Browse files
committed
Updated to execute the Github Action main script after copying the algo contents if exists
1 parent 5536c59 commit 50ea158

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

entrypoint.sh

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,21 @@ else
1515
git clone https://"$INPUT_ALGORITHMIA_USERNAME":"$INPUT_ALGORITHMIA_PASSWORD"@"$INPUT_GIT_HOST"/git/"$INPUT_ALGORITHMIA_USERNAME"/"$INPUT_ALGORITHMIA_ALGONAME".git $CI_ALGO_DIR
1616
fi
1717

18-
19-
20-
# Run action main to:
21-
# - (Optionally) run the notebook file
22-
# - Upload the model file to Algorithmia
23-
# - Link the algorithm with the uploaded model
24-
python3 /src/action_main.py
25-
26-
# Push updates to Algorithmia, and trigger a new algorithm build
27-
if [ $? -eq 0 ]
18+
if [ -d $INPUT_ALGORITHMIA_ALGONAME ]
2819
then
29-
echo "Successfully executed action script, optionally executing the model notebook and uploading the model file to Algorithmia."
30-
31-
if [ -d $INPUT_ALGORITHMIA_ALGONAME ]
32-
then
33-
echo "Will copy and push the contents of $INPUT_ALGORITHMIA_ALGONAME directory to Algorithm repository."
34-
cp -a "$INPUT_ALGORITHMIA_ALGONAME"/. $CI_ALGO_DIR/
35-
else
36-
echo "Could not locate the algorithm directory to push to Algorithmia."
37-
fi
38-
39-
cd $CI_ALGO_DIR
40-
git config --global user.name "$INPUT_ALGORITHMIA_USERNAME"
41-
git config --global user.email "$INPUT_ALGORITHMIA_EMAIL"
42-
git add .
43-
git commit -m "Automated deployment via Github CI"
44-
git push
20+
echo "Will copy and push the contents of $INPUT_ALGORITHMIA_ALGONAME directory to Algorithm repository."
21+
cp -a "$INPUT_ALGORITHMIA_ALGONAME"/. $CI_ALGO_DIR/
4522
else
46-
echo "Action script exited with error." >&2
47-
exit 1
23+
echo "Could not locate the algorithm directory to copy the contents."
4824
fi
4925

26+
python3 /src/action_main.py
27+
28+
echo "Switching to the algorithm repo directory to push changes to the Algorithm repo."
29+
cd $CI_ALGO_DIR
30+
git config --global user.name "$INPUT_ALGORITHMIA_USERNAME"
31+
git config --global user.email "$INPUT_ALGORITHMIA_EMAIL"
32+
git status
33+
git add .
34+
git commit -m "Automated deployment via Github CI"
35+
git push

0 commit comments

Comments
 (0)