ci: 🎡 修改issue模板 (#30) #20
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: Deploy Next.js to JD Cloud | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4.2.0 | |
| - name: Deploy to server via SSH | |
| uses: appleboy/ssh-action@v1.2.1 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USERNAME }} | |
| port: ${{ secrets.SERVER_PORT }} | |
| password: ${{ secrets.SERVER_PASSWORD }} | |
| script: | | |
| # 加载环境配置 | |
| source ~/.bashrc 2>/dev/null || true | |
| source ~/.profile 2>/dev/null || true | |
| # 加载 NVM 环境 | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
| # 设置 PATH | |
| export PATH="$HOME/.nvm/versions/node/*/bin:/usr/local/bin:/usr/bin:/bin:$HOME/.npm-global/bin:$PATH" | |
| # 设置工作目录 | |
| PROJECT_DIR="/home/DocFlow" | |
| mkdir -p $PROJECT_DIR | |
| cd $PROJECT_DIR | |
| # 克隆或更新代码 | |
| if [ ! -d ".git" ]; then | |
| echo "Cloning repository..." | |
| rm -rf ./* | |
| git clone git@github.com:xun082/DocFlow.git . | |
| else | |
| echo "Updating repository..." | |
| git fetch origin main | |
| git reset --hard origin/main | |
| fi | |
| # 创建 .npmrc 文件 (如果不存在) | |
| if [ ! -f ".npmrc" ]; then | |
| echo "Creating .npmrc file..." | |
| echo "@tiptap-pro:registry=https://registry.tiptap.dev/" > .npmrc | |
| echo "//registry.tiptap.dev/:_authToken=${{ secrets.TIPTAP_AUTH_TOKEN }}" >> .npmrc | |
| else | |
| echo ".npmrc file already exists, skipping creation." | |
| fi | |
| # 安装全局依赖 (只在需要时安装) | |
| command -v pnpm >/dev/null 2>&1 || npm install -g pnpm@9.4.0 | |
| command -v pm2 >/dev/null 2>&1 || npm install -g pm2 | |
| # 安装项目依赖 | |
| pnpm install | |
| # 构建项目 | |
| pnpm run build | |
| # 重启应用 | |
| pm2 restart DocFlow 2>/dev/null || pm2 start "pnpm start" --name DocFlow |