This commit is contained in:
shanshanzhong 2025-09-25 03:03:46 -07:00
parent 854273f6a4
commit 22f5197417

View File

@ -1,45 +1,74 @@
name: CI name: 发布 Web 镜像
run-name: 构建并发布 Web Docker 镜像
on: on:
workflow_dispatch:
push: push:
branches: branches:
- cicd - cicd
paths:
- "apps/**"
- "packages/**"
- "package.json"
- "turbo.json"
- ".gitea/workflows/docker.yml"
- "docker/**/Dockerfile"
pull_request: pull_request:
branches: types: [opened, synchronize, reopened]
- cicd paths:
- "apps/**"
- "packages/**"
- "package.json"
- "turbo.json"
- ".gitea/workflows/docker.yml"
- "docker/**/Dockerfile"
env: env:
REPO: ${{ vars.REPO }} REGISTRY_URL: registry.kxsw.us
ADMIN_IMAGE_NAME: ppanel/ppanel-admin-web
USER_IMAGE_NAME: ppanel/ppanel-user-web
jobs: jobs:
build: publish:
name: 发布 Web 镜像
runs-on: ppanel-web runs-on: ppanel-web
strategy:
matrix:
# 只有node支持版本号别名
node: ['20.15.1']
steps: steps:
- name: Checkout code - name: 检出代码
uses: https://gitea.cn/actions/checkout@v4 uses: actions/checkout@v4
### https://github.com/pnpm/action-setup - name: 从 package.json 提取版本
- name: Set up Node.js id: version
uses: https://github.com/pnpm/action-setup@v4 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: with:
version: 9.15.9 registry: ${{ env.REGISTRY_URL }}
run_install: false
- uses: https://gitea.cn/actions/setup-node@v4 - name: 构建并推送 ppanel-admin-web Docker 镜像
uses: docker/build-push-action@v6
with: with:
# gitea-tool-cache导出 node 具体版本 context: .
registry-url: https://registry.npmmirror.com file: ./docker/ppanel-admin-web/Dockerfile
cache: pnpm 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 - name: 构建并推送 ppanel-user-web Docker 镜像
run: pnpm config set canvas_binary_host_mirror https://registry.npmmirror.com/-/binary/canvas uses: docker/build-push-action@v6
with:
- name: Run Build Docker context: .
run: make build 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 }}