✨feat: 新增二维码生成插件支持 #29
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 | |
| on: | |
| push: | |
| branches: [ master ] # 触发分支,根据你的分支名称调整 | |
| # 允许您从 “Actions” 选项卡手动运行此工作流 | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检验代码 | |
| uses: actions/checkout@v4 | |
| - name: 使用 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 # 使用你项目所需的 Node.js 版本 | |
| - name: 检查 Node 版本 | |
| run: npm --version | |
| - name: 安装依赖关系 | |
| run: npm install | |
| - name: 构建 Vue 项目 | |
| run: npm run build # 假设你的构建命令是 npm run build | |
| - name: 通过 SSH 部署到服务器 | |
| env: | |
| SERVER_IP: ${{ secrets.SERVER_IP }} | |
| SERVER_USER: ${{ secrets.SERVER_USER }} | |
| DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} | |
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
| run: | | |
| # 配置 SSH 密钥 | |
| mkdir -p ~/.ssh | |
| echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| echo -e "Host *\n\tStrictHostKeyChecking no" > ~/.ssh/config | |
| # 上传构建文件到服务器(使用 scp,可替换为 rsync) | |
| scp -r ./dist/* "$SERVER_USER"@"$SERVER_IP":"$DEPLOY_PATH" |