add ci/cd test yml file (not test)
Some checks failed
Build and Push Docker Image / docker (push) Has been cancelled
Some checks failed
Build and Push Docker Image / docker (push) Has been cancelled
This commit is contained in:
47
.woodpecker.simple.yml
Normal file
47
.woodpecker.simple.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
# 简化版 Woodpecker CI 配置
|
||||
# 适用于快速测试和简单部署
|
||||
|
||||
when:
|
||||
event: [push, manual]
|
||||
branch: [main, develop]
|
||||
|
||||
environment:
|
||||
DOCKERHUB_USERNAME: ${DOCKERHUB_USERNAME}
|
||||
DOCKERHUB_TOKEN: ${DOCKERHUB_TOKEN}
|
||||
|
||||
steps:
|
||||
# 构建和推送
|
||||
- name: build-and-push
|
||||
image: /bin/zsh
|
||||
commands:
|
||||
- |
|
||||
set -e
|
||||
echo "=== 构建 vinatools 镜像 ==="
|
||||
|
||||
# 设置镜像标签
|
||||
if [ "${CI_BUILD_EVENT}" = "tag" ]; then
|
||||
TAG="${CI_COMMIT_TAG}"
|
||||
else
|
||||
TAG="${CI_COMMIT_BRANCH:-latest}"
|
||||
fi
|
||||
|
||||
# 清理标签
|
||||
TAG=$(echo "$TAG" | sed 's/[^a-zA-Z0-9._-]/-/g')
|
||||
IMAGE="${DOCKERHUB_USERNAME}/vinatools:${TAG}"
|
||||
|
||||
echo "构建镜像: ${IMAGE}"
|
||||
|
||||
# 登录 DockerHub
|
||||
echo "${DOCKERHUB_TOKEN}" | docker login --username "${DOCKERHUB_USERNAME}" --password-stdin
|
||||
|
||||
# 构建并推送
|
||||
docker buildx create --name builder --use || true
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--file docker/Dockerfile \
|
||||
--tag "${IMAGE}" \
|
||||
--tag "${DOCKERHUB_USERNAME}/vinatools:latest" \
|
||||
--push \
|
||||
.
|
||||
|
||||
echo "✅ 构建完成: ${IMAGE}"
|
||||
Reference in New Issue
Block a user