From 22f519741771b9f325d2847c7a5fb92e04850d7c Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Thu, 25 Sep 2025 03:03:46 -0700 Subject: [PATCH] ci --- .gitea/workflows/docker.yml | 85 +++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 443c963..8184c51 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -1,45 +1,74 @@ -name: CI +name: 发布 Web 镜像 +run-name: 构建并发布 Web Docker 镜像 on: + workflow_dispatch: push: branches: - cicd + paths: + - "apps/**" + - "packages/**" + - "package.json" + - "turbo.json" + - ".gitea/workflows/docker.yml" + - "docker/**/Dockerfile" pull_request: - branches: - - cicd + types: [opened, synchronize, reopened] + paths: + - "apps/**" + - "packages/**" + - "package.json" + - "turbo.json" + - ".gitea/workflows/docker.yml" + - "docker/**/Dockerfile" env: - REPO: ${{ vars.REPO }} + REGISTRY_URL: registry.kxsw.us + ADMIN_IMAGE_NAME: ppanel/ppanel-admin-web + USER_IMAGE_NAME: ppanel/ppanel-user-web jobs: - build: + publish: + name: 发布 Web 镜像 runs-on: ppanel-web - - - strategy: - matrix: - # 只有node支持版本号别名 - node: ['20.15.1'] - steps: - - name: Checkout code - uses: https://gitea.cn/actions/checkout@v4 + - name: 检出代码 + uses: actions/checkout@v4 - ### https://github.com/pnpm/action-setup - - name: Set up Node.js - uses: https://github.com/pnpm/action-setup@v4 + - name: 从 package.json 提取版本 + id: version + run: echo "VERSION=$(jq -r .version package.json)" >> $GITEA_OUTPUT + + - name: 设置 QEMU + uses: docker/setup-qemu-action@v3 + + - name: 设置 Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: 登录 Docker Registry + uses: docker/login-action@v3 with: - version: 9.15.9 - run_install: false + registry: ${{ env.REGISTRY_URL }} - - uses: https://gitea.cn/actions/setup-node@v4 + - name: 构建并推送 ppanel-admin-web Docker 镜像 + uses: docker/build-push-action@v6 with: - # gitea-tool-cache导出 node 具体版本 - registry-url: https://registry.npmmirror.com - cache: pnpm + context: . + file: ./docker/ppanel-admin-web/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY_URL }}/${{ env.ADMIN_IMAGE_NAME }}:latest + ${{ env.REGISTRY_URL }}/${{ env.ADMIN_IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} - - name: set cavans registry - run: pnpm config set canvas_binary_host_mirror https://registry.npmmirror.com/-/binary/canvas - - - name: Run Build Docker - run: make build + - name: 构建并推送 ppanel-user-web Docker 镜像 + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/ppanel-user-web/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY_URL }}/${{ env.USER_IMAGE_NAME }}:latest + ${{ env.REGISTRY_URL }}/${{ env.USER_IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}