Skip to content

Commit ae7c2d8

Browse files
committed
优化构建脚本
1 parent e9ef0c2 commit ae7c2d8

1 file changed

Lines changed: 70 additions & 4 deletions

File tree

.github/workflows/build-all-in-one.yml

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,71 @@ jobs:
3939
- name: Checkout repository
4040
uses: actions/checkout@v4
4141

42+
- name: Debug - List files in web directory
43+
working-directory: web
44+
run: |
45+
echo "=== Files in web directory ==="
46+
ls -la
47+
echo "=== Checking for lock files ==="
48+
ls -la *.lock* *.yaml 2>/dev/null || echo "No lock files found"
49+
50+
- name: Install pnpm
51+
uses: pnpm/action-setup@v2
52+
with:
53+
version: 9
54+
4255
- name: Setup Node.js
4356
uses: actions/setup-node@v4
4457
with:
4558
node-version: '20'
46-
cache: 'npm'
47-
cache-dependency-path: web/package-lock.json
59+
cache: 'pnpm'
60+
cache-dependency-path: web/pnpm-lock.yaml
61+
62+
- name: Debug - Verify pnpm installation
63+
run: |
64+
echo "=== pnpm version ==="
65+
pnpm --version
66+
echo "=== node version ==="
67+
node --version
68+
echo "=== npm version ==="
69+
npm --version
4870
4971
- name: Install dependencies
5072
working-directory: web
51-
run: npm ci
73+
run: |
74+
echo "=== Installing dependencies ==="
75+
pnpm install --frozen-lockfile
76+
echo "=== Installation completed ==="
77+
78+
- name: Debug - Check installed packages
79+
working-directory: web
80+
run: |
81+
echo "=== Checking node_modules ==="
82+
ls -la node_modules | head -20
83+
echo "=== Package count ==="
84+
find node_modules -type d -maxdepth 1 | wc -l
5285
5386
- name: Build frontend
5487
working-directory: web
55-
run: npm run build
88+
run: |
89+
echo "=== Building frontend ==="
90+
pnpm run build
91+
echo "=== Build completed ==="
92+
93+
- name: Debug - Check build output
94+
working-directory: web
95+
run: |
96+
echo "=== Build output directory ==="
97+
ls -la dist/ 2>/dev/null || echo "dist directory not found"
98+
du -sh dist/ 2>/dev/null || echo "Cannot check dist size"
5699
57100
- name: Upload frontend artifacts
58101
uses: actions/upload-artifact@v4
59102
with:
60103
name: frontend-dist
61104
path: web/dist/
62105
retention-days: 1
106+
if-no-files-found: error
63107

64108
build-and-push:
65109
name: Build and Push Docker Image
@@ -79,12 +123,27 @@ jobs:
79123
name: frontend-dist
80124
path: web/dist/
81125

126+
- name: Debug - Verify artifacts
127+
run: |
128+
echo "=== Checking downloaded artifacts ==="
129+
ls -la web/dist/ 2>/dev/null || echo "Artifacts not found"
130+
du -sh web/dist/ 2>/dev/null || echo "Cannot check artifacts size"
131+
82132
- name: Set up QEMU
83133
uses: docker/setup-qemu-action@v3
84134

85135
- name: Set up Docker Buildx
86136
uses: docker/setup-buildx-action@v3
87137

138+
- name: Debug - Docker info
139+
run: |
140+
echo "=== Docker version ==="
141+
docker --version
142+
echo "=== Docker buildx version ==="
143+
docker buildx version
144+
echo "=== Available platforms ==="
145+
docker buildx inspect --bootstrap
146+
88147
- name: Login to Alibaba Cloud Container Registry
89148
uses: docker/login-action@v3
90149
with:
@@ -131,6 +190,13 @@ jobs:
131190
# 分支名 + commit sha (用于开发测试)
132191
type=sha,prefix={{branch}}-,enable=${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }}
133192
193+
- name: Debug - Show image tags
194+
run: |
195+
echo "=== Aliyun tags ==="
196+
echo "${{ steps.meta-aliyun.outputs.tags }}"
197+
echo "=== Docker Hub tags ==="
198+
echo "${{ steps.meta-dockerhub.outputs.tags }}"
199+
134200
- name: Build and push Docker image to both registries
135201
id: docker_build
136202
uses: docker/build-push-action@v5

0 commit comments

Comments
 (0)