fix: ci build

This commit is contained in:
xxnuo
2025-11-19 22:02:00 +08:00
parent 8fa979ff24
commit 23f87a45fc
2 changed files with 42 additions and 13 deletions

View File

@@ -67,6 +67,12 @@ jobs:
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
@@ -77,14 +83,37 @@ jobs:
with:
version: 9
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Build UI
run: |
cd ui
pnpm install --frozen-lockfile
pnpm build
echo "UI build complete"
echo "UI build complete"
ls -lh dist/
- name: Download resources
run: |
make download
echo "✓ Resources downloaded"
- name: Generate docs
run: |
make generate-docs
echo "✓ Docs generated"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:

View File

@@ -16,21 +16,21 @@ RUN go mod download
# Copy source code (UI dist should be pre-built and copied)
COPY . .
# Verify UI dist exists (should be built before docker build)
RUN if [ ! -f "ui/dist/index.html" ]; then \
# Verify required files exist (should be prepared before docker build)
RUN echo "Verifying build prerequisites..." && \
if [ ! -f "ui/dist/index.html" ]; then \
echo "ERROR: ui/dist/index.html not found!"; \
echo "Please build UI before docker build:"; \
echo " cd ui && pnpm install && pnpm build"; \
exit 1; \
fi && \
echo "✓ UI dist verified" && \
ls -lh ui/dist/
# Download resources
RUN make download
# Generate docs
RUN make generate-docs
if [ ! -f "bin/worker" ]; then \
echo "ERROR: bin/worker not found!"; \
exit 1; \
fi && \
if [ ! -f "internal/docs/swagger.json" ]; then \
echo "ERROR: internal/docs/swagger.json not found!"; \
exit 1; \
fi && \
echo "✓ All prerequisites verified"
# Build binary
ARG VERSION=dev