rollback #158
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: rollback | |
| on: | |
| schedule: | |
| - cron: '59 15 * * *' | |
| jobs: | |
| download: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Set timezone to Asia/Shanghai | |
| run: | | |
| sudo timedatectl set-timezone Asia/Shanghai | |
| date | |
| - name: Deploy zhiqingyun rollback | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| script_stop: true | |
| timeout: 1800s | |
| script: | | |
| jps | grep zhiqingyun.jar | awk '{print $1}' | xargs -r kill -9 | |
| if [ -d "/opt/zhiqingyun/resources_back" ]; then | |
| rm -rf /opt/zhiqingyun/resources/* | |
| cp -r /opt/zhiqingyun/resources_back/* /opt/zhiqingyun/resources/ | |
| fi | |
| if [ ! -d "/opt/zhiqingyun/resources_back" ]; then | |
| mkdir -p /opt/zhiqingyun/resources_back | |
| cp -r /opt/zhiqingyun/resources/* /opt/zhiqingyun/resources_back/ | |
| fi | |
| rm -rf /tmp/libprql_* | |
| rm -rf /tmp/tomcat.8080.* | |
| rm -rf /tmp/tomcat-docbase.8080.* | |
| bash /opt/zhiqingyun/bin/start.sh --print-log=false | |
| sleep 120 | |
| until curl -s https://zhiqingyun-demo.isxcode.com/tools/open/health | grep "UP"; do | |
| echo "Waiting for service to be available..." | |
| sleep 1 | |
| done |