ci: 添加构建和部署工作流
Build and Deploy Vue3 / build (push) Failing after 9s
Build and Deploy Vue3 / deploy (push) Has been skipped

- 新增 build-service-server.yaml 和 build-test-server.yaml 文件
- 设置 pnpm 安装和项目构建步骤
- 实现代码部署到测试和生产服务器的功能
- 添加域名替换和 SSH 密钥配置
This commit is contained in:
2025-09-12 16:42:19 +08:00
parent d9021caca2
commit 479c04d34c
2 changed files with 112 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
name: 'Build and Deploy Vue3'
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install pnpm
run: |
npm install -g pnpm
- name: Install dependencies
run: |
pnpm install
- name: Build project
run: |
pnpm build
- name: Save artifact
uses: actions/upload-artifact@v3
with:
name: vue3-build
path: |
./dist
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: vue3-build
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PUBLICT_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ vars.WEB_TEST_SERVER_IP }} >> ~/.ssh/known_hosts
- name: Deploy to server
run: |
scp -o StrictHostKeyChecking=no -r ./* ${{ vars.ROOT_USER_NAME }}@${{ vars.WEB_TEST_SERVER_IP }}:/www/wwwroot/apiserver_admin.s1f.ren/