diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index accbc4b..b3f19a5 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -21,12 +21,19 @@ jobs: git clone --depth 1 "http://test:89085111dd6939710a992d6404bd61a50e420685@8.138.239.222:20300/${GITHUB_REPOSITORY}.git" . git checkout "${GITHUB_SHA}" + - uses: https://gitea.com/actions/setup-python@v5 + with: + python-version: '3.7' + cache: 'pip' + # 如果有多个 requirements 文件: + # cache-dependency-path: '**/requirements*.txt' + - name: Build run: | mkdir dist PYTHONUSERBASE=$CI_PROJECT_DIR/home pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple --user PYTHONUSERBASE=$CI_PROJECT_DIR/home pip install -r ./requirements.txt -i https://mirrors.aliyun.com/pypi/simple --user - rsync -ha ./ ./dist --exclude=dist --exclude=.git --delete + - name: Deploy run: | @@ -37,12 +44,19 @@ jobs: chmod 600 ~/.ssh/id_rsa ssh -o StrictHostKeyChecking=no root@$DEPLOY_TEST_HOST_IP "mkdir -p $DEPLOY_PATH" - rsync -r ./dist/ ${DEPLOY_DEV_HOST_IP}:${DEPLOY_PATH} --delete - ssh ${SSH_OPTS} ${DEPLOY_DEV_HOST_IP} "cd ${DEPLOY_PATH} && source /etc/profile && docker-compose up -d --force-recreate" - - ssh root@$DEPLOY_TEST_HOST_IP "rm -f $DEPLOY_PATH/*.jar" - scp ruoyi-admin/target/ruoyi-admin.jar root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/ - ssh root@$DEPLOY_TEST_HOST_IP "mv $DEPLOY_PATH/ruoyi-admin.jar $DEPLOY_PATH/app.jar" - scp docker-compose.test.yml root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/ - ssh root@$DEPLOY_TEST_HOST_IP "mv $DEPLOY_PATH/docker-compose.test.yml $DEPLOY_PATH/docker-compose.yml" + ssh root@$DEPLOY_TEST_HOST_IP "rm -f $DEPLOY_PATH/**" + scp ./** root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/ ssh root@$DEPLOY_TEST_HOST_IP "cd $DEPLOY_PATH && docker compose up -d --force-recreate" + +# ssh ${SSH_OPTS} ${DEPLOY_DEV_HOST_IP} "cd ${DEPLOY_PATH} && source /etc/profile && docker-compose up -d --force-recreate" +# +# rsync -ha ./ ./dist --exclude=dist --exclude=.git --delete +# rsync -r ./dist/ ${DEPLOY_DEV_HOST_IP}:${DEPLOY_PATH} --delete +# ssh ${SSH_OPTS} ${DEPLOY_DEV_HOST_IP} "cd ${DEPLOY_PATH} && source /etc/profile && docker-compose up -d --force-recreate" +# +# ssh root@$DEPLOY_TEST_HOST_IP "rm -f $DEPLOY_PATH/*.jar" +# scp ruoyi-admin/target/ruoyi-admin.jar root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/ +# ssh root@$DEPLOY_TEST_HOST_IP "mv $DEPLOY_PATH/ruoyi-admin.jar $DEPLOY_PATH/app.jar" +# scp docker-compose.test.yml root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/ +# ssh root@$DEPLOY_TEST_HOST_IP "mv $DEPLOY_PATH/docker-compose.test.yml $DEPLOY_PATH/docker-compose.yml" +# ssh root@$DEPLOY_TEST_HOST_IP "cd $DEPLOY_PATH && docker compose up -d --force-recreate"