From 44eca75e6e63ac87fb6875e8891282c6d371927d Mon Sep 17 00:00:00 2001 From: Guichumo <836061373@qq.com> Date: Sun, 22 Nov 2026 23:26:07 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=8F=91=E5=B8=83=E9=AA=8C=E6=94=B6=20P0?= =?UTF-8?q?=20=E9=A1=B9=E2=80=94=E2=80=94=E8=A1=A5=E9=BD=90=20CI/CD=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .github/workflows/ci.yml: push/PR 触发,复用 halo-sigs/reusable-workflows plugin-ci.yaml@v5 执行 ./gradlew clean build(全部测试+检查) - .github/workflows/cd.yml: GitHub Release published 触发,复用 plugin-cd.yaml@v5, 按发布 tag 去 v 前缀注入 -Pversion 构建(-x check,不替代发布前 CI), skip-appstore-release: true——首次上架审核前只上传 Release 资产,不自动同步应用市场 - 根目录 gradlew/gradlew.bat: 转发到 plugin-operation-audit/ 的 Gradle wrapper (官方可复用工作流从仓库根执行 ./gradlew,build-args 以 -p 指定子项目目录) - artifacts-path 限定 plugin-operation-audit/build/libs(仅插件 JAR,不误传其他制品) --- .github/workflows/cd.yml | 27 +++++++++++++++++++++++++++ .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ gradlew | 6 ++++++ gradlew.bat | 6 ++++++ 4 files changed, 64 insertions(+) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml create mode 100644 gradlew create mode 100644 gradlew.bat diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..5f617ae --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,27 @@ +name: CD + +# Halo 官方可复用插件 CD 工作流:基于 GitHub Release tag 注入版本号构建 JAR 并 +# 上传到 Release 资产。可复用工作流内部执行: +# ./gradlew clean build -x check -Pversion=${tag 去 v 前缀} +# 因此 Release tag(如 v0.1.0)自动保证 JAR 文件名 / plugin.yaml spec.version / +# Manifest Implementation-Version 三处一致。 +# 注意:CD 构建带 -x check,不能替代发布前必须通过且不可跳过的 CI 与测试。 +# 首次上架应用市场审核通过前,skip-appstore-release: true —— 只上传 +# GitHub Release 资产,不自动同步应用市场;审核通过后按官方发布文档 +# 配置 app-id 与最小权限的个人令牌(HALO_PAT)后再开启同步。 +on: + release: + types: + - published + +jobs: + cd: + uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v5 + permissions: + contents: write + with: + ui-path: "plugin-operation-audit/ui" + artifacts-path: "plugin-operation-audit/build/libs" + build-args: "-p plugin-operation-audit" + skip-node-setup: true + skip-appstore-release: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..149307e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +# Halo 官方可复用插件 CI 工作流:./gradlew clean build(含全部后端测试与 UI 检查)。 +# 本仓库 Gradle 构建根在 plugin-operation-audit/ 子目录: +# - 根目录 gradlew/gradlew.bat 是转发脚本; +# - build-args 传 -p 指定项目目录。 +# UI 子项目使用 npm(package-lock.json),没有 pnpm-lock.yaml, +# 因此 skip-node-setup: true,由 ubuntu-latest 预装的 Node/npm 配合 +# node-gradle 插件(download = false)完成前端构建与 vitest 测试。 +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + ci: + uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v5 + with: + ui-path: "plugin-operation-audit/ui" + artifacts-path: "plugin-operation-audit/build/libs" + build-args: "-p plugin-operation-audit" + skip-node-setup: true diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..96f4427 --- /dev/null +++ b/gradlew @@ -0,0 +1,6 @@ +#!/bin/sh +# 仓库根目录不是 Gradle 构建根:插件项目位于 plugin-operation-audit/ 子目录。 +# Halo 官方可复用插件 CI/CD 工作流(halo-sigs/reusable-workflows)从仓库根执行 +# ./gradlew clean build,此脚本将调用转发到子项目的 Gradle wrapper。 +# 本地等价命令:./gradlew clean build -p plugin-operation-audit +exec "$(dirname "$0")/plugin-operation-audit/gradlew" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..e095d36 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,6 @@ +@echo off +rem 仓库根目录不是 Gradle 构建根:插件项目位于 plugin-operation-audit\ 子目录。 +rem Halo 官方可复用插件 CI/CD 工作流(halo-sigs/reusable-workflows)从仓库根执行 +rem ./gradlew clean build,此脚本将调用转发到子项目的 Gradle wrapper。 +rem 本地等价命令:gradlew.bat clean build -p plugin-operation-audit +"%~dp0plugin-operation-audit\gradlew.bat" %*