mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
c484847adf
* added commands to reload script
* catch errors with git pull
* read new webhook from os variable
* correcting bash
* bash fixes
* formatting
* more robust error checking
* only sends success if git changes
* catching error from script
* escaping error text to send with curl
* correct text escaping for error message
Former-commit-id: c95f88075b
22 lines
650 B
Bash
22 lines
650 B
Bash
#!/bin/sh
|
|
set -e
|
|
. /home/ubuntu/.bashrc
|
|
export PATH="/usr/local/bin:/usr/bin:/bin"
|
|
|
|
git pull > /tmp/git_changes.txt
|
|
|
|
if grep -q "Already up to date." /tmp/git_changes.txt; then
|
|
echo "Already up to date. No reload."
|
|
else
|
|
echo "Reloading..."
|
|
if grep -q "demo/" /tmp/git_changes.txt; then
|
|
cd upload_notebooks && python run.py && cd ..
|
|
fi
|
|
docker-compose build
|
|
docker-compose up -d
|
|
|
|
LATEST=$(git log -1 | fgrep commit)$(git log -1 | tail -1)
|
|
curl -X POST -H 'Content-type: application/json' --data '{"text":"gradio.app relaoded successfully! :ship:\n\n Latest live commit:\n>`'"${LATEST}"'`"}' ${SLACK_WEBHOOK}
|
|
|
|
fi
|