Skip to content

Commit f17da4e

Browse files
committed
ci: 将 GitLab CI 迁移至 GitHub Actions
- 新增 .github/workflows/build.yml - 构建阶段:pnpm 安装、生成 sitemap、构建前端 - Docker 阶段:构建并推送镜像至 ghcr.io - 删除 .gitlab-ci.yml Made-with: Cursor
1 parent c82f058 commit f17da4e

File tree

3 files changed

+90
-69
lines changed

3 files changed

+90
-69
lines changed

.github/workflows/build.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
branches:
10+
- main
11+
- dev
12+
13+
env:
14+
NODE_VERSION: "20"
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: latest
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ env.NODE_VERSION }}
31+
cache: "pnpm"
32+
33+
- name: Install dependencies
34+
working-directory: frontend
35+
run: pnpm install --frozen-lockfile
36+
37+
- name: Generate sitemap
38+
working-directory: frontend
39+
run: |
40+
sudo apt-get update && sudo apt-get install -y python3 python3-pip
41+
pip3 install requests --break-system-packages
42+
python3 scripts/generate-sitemap.py || true
43+
44+
- name: Build
45+
working-directory: frontend
46+
run: pnpm run build
47+
48+
- name: Upload dist
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: dist
52+
path: frontend/dist/
53+
54+
docker:
55+
needs: build
56+
runs-on: ubuntu-latest
57+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Download dist
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: dist
65+
66+
- name: Copy dist to docker
67+
run: cp -r dist frontend/docker/dist
68+
69+
- name: Set up Docker Buildx
70+
uses: docker/setup-buildx-action@v3
71+
72+
- name: Login to GitHub Container Registry
73+
uses: docker/login-action@v3
74+
with:
75+
registry: ghcr.io
76+
username: ${{ github.actor }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Build and push
80+
uses: docker/build-push-action@v6
81+
with:
82+
context: frontend/docker
83+
push: true
84+
tags: |
85+
ghcr.io/${{ github.repository_owner }}/monkeycode-frontend:${{ github.sha }}
86+
ghcr.io/${{ github.repository_owner }}/monkeycode-frontend:latest
87+
platforms: linux/amd64

.gitlab-ci.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ MonkeyCode 是由长亭科技推出的企业级 AI 开发平台。
88

99
## 快速开始
1010

11-
详见 [frontend/README.md](./frontend/README.md)
11+
```bash
12+
cd frontend && pnpm install && pnpm dev
13+
```

0 commit comments

Comments
 (0)