Files
BackupX/Makefile
Awuqing 0aa25d99f2 ci: add automated release pipeline with Docker Hub push and China mirror support
- Fix Go/Node version mismatch in CI (1.21→1.25, 18→20)
- Rewrite release.yml: 3-job pipeline (frontend → binary release + Docker push)
  - Supports both tag push and manual workflow_dispatch trigger
  - Builds linux/amd64 + linux/arm64 binaries → GitHub Release tar.gz
  - Builds multi-arch Docker image → Docker Hub (awuqing/backupx)
- Dockerfile: add ARG USE_CHINA_MIRROR for China network acceleration
  (npm→npmmirror, go→goproxy.cn, apk→aliyun), add ARG VERSION injection
- Makefile: auto version from git tag, add docker/docker-cn targets
- README: add beginner-friendly China build guide and release instructions
2026-03-30 23:32:14 +08:00

42 lines
1.0 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.PHONY: build dev test clean docker docker-cn
# 自动获取版本号(从 git tag 或 commit hash
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
# ── 一键构建 ──
build: build-server build-web
build-server:
cd server && CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o bin/backupx ./cmd/backupx
build-web:
cd web && npm run build
# ── 开发模式(分别在两个终端运行)──
dev-server:
cd server && go run ./cmd/backupx
dev-web:
cd web && npm run dev
# ── 测试 ──
test: test-server test-web
test-server:
cd server && go test ./...
test-web:
cd web && npm run test
# ── Docker 构建 ──
docker:
docker build --build-arg VERSION=$(VERSION) -t backupx:$(VERSION) -t backupx:latest .
# 国内加速构建(使用国内镜像源)
docker-cn:
docker build --build-arg VERSION=$(VERSION) --build-arg USE_CHINA_MIRROR=true -t backupx:$(VERSION) -t backupx:latest .
# ── 清理 ──
clean:
rm -rf server/bin web/dist