diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..e3dd2f1 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy to Test + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H micecola.top >> ~/.ssh/known_hosts + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Create remote directory + run: | + ssh kb_admin@micecola.top "mkdir -p /www/wwwroot/kb-web-test/zhangqing" + + - name: Deploy to server + run: | + rsync -avz --delete \ + --exclude='.git' \ + --exclude='.gitea' \ + --exclude='*.pyc' \ + --exclude='__pycache__' \ + ./ kb_admin@micecola.top:/www/wwwroot/kb-web-test/zhangqing/