Skip to content

web: add display yeild chart #61

web: add display yeild chart

web: add display yeild chart #61

name: "Deploy with git"
on:
push:
branches:
- main
concurrency:
group: ${{ github.event.ref }}
cancel-in-progress: true
env:
SSH_KEY_FILE_DIR: .keys
SSH_KEY_FILE_PATH: .keys/deploy_key.pem
jobs:
ssh_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create deploy key file
run: |
mkdir ${{env.SSH_KEY_FILE_DIR}}
echo "${{secrets.SSH_DEPLOY_KEY}}" > ${{env.SSH_KEY_FILE_PATH}}
chmod 600 ${{env.SSH_KEY_FILE_PATH}}
- name: Deploy with git
run: |
SSH_DEPLOY_COMMAND="cd ${{secrets.SSH_DEPLOY_PATH}} && git pull && git submodule update"
HAS_PYTHON_CHANGE=true
GIT_CHANGED_FILE=$(git show --name-only)
if [[ $(echo $GIT_CHANGED_FILE | grep "\.py") == "" && $(echo $GIT_CHANGED_FILE | grep "\.sh") == "" ]]; then
HAS_PYTHON_CHANGE=false
fi
if [[ $HAS_PYTHON_CHANGE == true ]]; then
if [[ $(echo $GIT_CHANGED_FILE | grep "requirements.txt") != "" ]]; then
SSH_DEPLOY_COMMAND="$SSH_DEPLOY_COMMAND && ./pip-install-binary.sh"
fi
SSH_DEPLOY_COMMAND="$SSH_DEPLOY_COMMAND && ./restart-app.sh"
fi
echo $SSH_DEPLOY_COMMAND
ssh -i ${{env.SSH_KEY_FILE_PATH}} -o StrictHostKeyChecking=no ${{secrets.SSH_DEPLOY_USER}}@${{secrets.SSH_DEPLOY_HOST}} "$SSH_DEPLOY_COMMAND"
- name: Clean deploy key file
run: rm -rf ${{env.SSH_KEY_FILE_PATH}}