This commit is contained in:
shanshanzhong 2025-09-25 02:49:29 -07:00
parent ed9cbde7be
commit eed624e491

View File

@ -1,74 +1,62 @@
name: 发布 Web 镜像 name: CI
run-name: 构建并发布 Web Docker 镜像
on: on:
workflow_dispatch:
push: push:
branches: branches:
- cicd - main
paths:
- "apps/**"
- "packages/**"
- "package.json"
- "turbo.json"
- ".gitea/workflows/docker.yml"
- "docker/**/Dockerfile"
pull_request: pull_request:
types: [opened, synchronize, reopened] branches:
paths: - main
- "apps/**"
- "packages/**"
- "package.json"
- "turbo.json"
- ".gitea/workflows/docker.yml"
- "docker/**/Dockerfile"
env: env:
REGISTRY_URL: registry.kxsw.us DOMAIN_URL: git.studyfor.work #*修改为你自己的域名
ADMIN_IMAGE_NAME: ppanel/ppanel-admin-web REPO: ${{ vars.REPO }}
USER_IMAGE_NAME: ppanel/ppanel-user-web DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ vars.DOCKER_PASSWORD}}
jobs: jobs:
publish: build:
name: 发布 Web 镜像 runs-on: ubuntu-latest
runs-on: ppanel-web strategy:
matrix:
# 只有node支持版本号别名
node: ['20.15.1']
steps: steps:
- name: 检出代码 - name: Checkout code
uses: actions/checkout@v4 uses: https://gitea.cn/actions/checkout@v4
- name: 从 package.json 提取版本 - name: change npm registry mirror
id: version run: npm config set registry https://registry.npmmirror.com
run: echo "VERSION=$(jq -r .version package.json)" >> $GITEA_OUTPUT
- name: 设置 QEMU ### https://github.com/pnpm/action-setup
uses: docker/setup-qemu-action@v3 - name: Set up Node.js
uses: https://github.com/pnpm/action-setup@v4
- name: 设置 Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 登录 Docker Registry
uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY_URL }} version: 9.15.9
run_install: false
- name: 构建并推送 ppanel-admin-web Docker 镜像
uses: docker/build-push-action@v6
with:
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: 构建并推送 ppanel-user-web Docker 镜像 - uses: https://gitea.cn/actions/setup-node@v4
uses: docker/build-push-action@v6
with: with:
context: . # gitea-tool-cache导出 node 具体版本
file: ./docker/ppanel-user-web/Dockerfile registry-url: https://registry.npmmirror.com
platforms: linux/amd64,linux/arm64 cache: pnpm
push: true
tags: | - name: set cavans registry
${{ env.REGISTRY_URL }}/${{ env.USER_IMAGE_NAME }}:latest run: pnpm config set canvas_binary_host_mirror https://registry.npmmirror.com/-/binary/canvas
${{ env.REGISTRY_URL }}/${{ env.USER_IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
- name: Install dependencies
run: pnpm install
- name: Run Build Project
run: pnpm run build
- name: Run Build Docker
run: make docker
- name: Run Push Image
run: make publish-docker
- name: Run Docker Compose
run: make run-docker