name: 部署到腾讯云
on:
  push:
    branches:
      - main

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    env:
      MYREGISTRY : ${{ vars.MYREGISTRY }}
      MYIMAGE : ${{ vars.MYIMAGE }}
      MYPORT: ${{ vars.MYPORT }}
    steps:
      - name: 远程部署
        uses: https://git.des8.com/docker/ssh-action@v1.0.0
        with:
          host: 122.51.147.115
          port: 8022
          username: root
          key: ${{ secrets.KEY }}
          script: |
            cd /www/wwwroot/doc-live.des8.com
            git config --global --add safe.directory /www/wwwroot/doc-live.des8.com
            git clean -f
            git remote rm origin
            git remote add origin git@git.des8.com:weixiu/ai-live.git
            chmod 0600 ~/.ssh/id_rsa
            git fetch --all
            git reset --hard origin/main
            git pull origin main
            rm -rf /www/wwwroot/mei.des8.com/.gitea
            chown -R www:www ./
            pwd && ls -l
