Skip to content

Commit

Permalink
release: 第一个正式版 (#206)
Browse files Browse the repository at this point in the history
* feat: context

* perf: 优化配置文件导入

* perf: getYaml可选参数

* fix: Watcher.value return  array

* feat: plugin hmr

* perf: 优化导出

* fix: 修正类插件导出错误 加载插件抛出异常捕获

* fix: 函数防抖

* docs: 简化

* Create LICENSE

* feat: onebot11正向、鉴权

* feat: onebot11http、鉴权

* feat: level redis

* feat: 渲染

* feat: 插件依赖缺失打印、快速回复中间件

* feat: 哦吼 还剩个合并转发中间件捏

* feat: 最后一个中间件

* fix: pm2 scripts

* fix: build

* feat: 新增pr工作流

* fix: 不应该直接删release的。。。

* fix: 这合并的是啥玩意啊

* fix: actions

* fix: 奇奇怪怪的

* pr版本号: <主版本号>.<次版本号>.<修订号>-<预发布标识>.<PR标识>.<PR编号>.<工作流唯一编号>-<时间戳>

* fix: 优化构建提示

* 更新 pr.yml

* fix: no such file or directory

* fix: init error

* fix: 创建配置文件优先级

* fix: 初始化的时候修改为esm环境

* 更新 package.json

* 更新 package.json

* feat: 初步新增npm插件更新

* fix: up error

* feat: git插件更新

* fix: 无更新

* fix: 优化更新提示

* feat: ffmpeg ffprobe ffplay

* feat: npx karin ts

* fix: 修正混乱的判断

* fix: 加载apps错误

* feat: types包

* fix: build error

* 啥也不是。。。

* fix: plugins不存在

* perf: 兼容性提高

* perf: 兼容Bot 补充handler

* feat: karin.handler

* perf: 兼容性提高

* perf: `sendMsg`返回值

* fix: 修正ws类型

* fix: 补充 TaskOptions 接口参数
fix: 导出漏掉的 render/types

* refactor: 重构渲染器返回值 仅返回str

* fix: 修正群文件相关类型

* fix: build

* fix: 热更新后定时任务停止

* feat: save时自动写入注释

* fix: 防抖函数导致的错误退出异常

* fix: 修正提示日志

* fix: 兼容性提升

* fix: 兼容性提升

* fix: TypeScript 监察者模式

* fix: qaq 我是笨比

* fix: build error

* fix: pkg修改为纯函数

* fix: 兼容性提高

* fix: build error

* fix: 兼容性提高

* fix: 类型错误

* fix: 类型错误

* fix: 类型优化

* fix: 修正类型

* fix: 新增sendApi 修正编译错误

* fix: 处理包名为组织名称

* fix: `npx karin ts -w`

* fix: 嵌套合并转发类型错误

* fix: 多层嵌套类型错误

* fix: onebot嵌套转发兼容性提升

* fix: onebot请求错误 栈打印对齐

* fix: 兼容性提高

* fix: ctx超时修改为抛出异常而不是返回`null`

* feat: ts main

* perf: tips

* feat: 主人和管理员支持指定Bot 新增发主人 发管理方法

* fix: 初始化错误

* fix: 初始化逻辑优化

* fix: 初始化完成主动退出

* perf: 路径修改为映射

* feat: protocol qqbot

* fix: export error

* fix: 修正拼接模板路径错误

* 更新 template.ts

* fix: 好嘛 我是笨比

* feat: restart

* feat: 更新npm包支持指定标签

* fix: on 该死 为什么你要抛出错误~~~

* fix: 初始化express

* fix: ffmpeg明确返回类型

* fix: 写漏了

* feat: `mergeImage` 修复`ffmpeg`相关函数的返回值

* fix: 修复传参`booleanResult`的时候返回值错误

* fix: 啊 我是笨比~

* fix: `mergeImage`兼容性提高

* fix: 安逸

* fix: 抽象

* fix: ccc

* feat: fileToUrl

* export fileToUrl

* 更新 fileToUrl.ts

* fix: `fileToUrl` 修改返回值类型

* fix: `fileToUrl` 支持更多文件数据

* fix: 被动事件支持来源

* feat: 支持创建频道、频道私信事件

* fix: 修正`message`子事件的类型

* fix: 过早return

* fix: 更新账号子ID结构为键值对并调整相关方法

* fix: 优化日志输出格式,增强可读性

* refactor: 将CD相关参数名称从`isCD`更改为`cd`,增强代码可读性

* fix: 优化事件提示格式,增强可读性

* feat: 更新runTsx函数以支持动态包含和排除文件,增强灵活性

* feat: 添加.pnpmfile.cjs以清空对等依赖中的node-karin并支持插件开发环境

* fix: 修复对等依赖中node-karin的检查逻辑,确保正确清空依赖

* fix: 移除配置中的dist目录,优化初始化设置

* feat: 添加重启接口

* feat: 导出重启接口,简化API访问

* feat: 重构重启逻辑,新增直接重启功能并优化发布流程

* feat: 优化重启函数,支持环境检查并返回重启状态

* feat: 引入消息事件常量,优化事件处理逻辑

* feat: 优化事件基类,添加消息发送逻辑并更新结果类型

* feat: 更新事件计数逻辑,简化插件信息传递

* feat: 添加日志解析功能,支持提取指定版本的更新日志

* feat: 添加npm包更新检查功能,优化版本获取逻辑并处理错误

* feat: 修改checkPkgUpdate函数返回值,改为布尔类型以简化更新检查逻辑

* feat: 修改checkPkgUpdate函数返回值,返回更新状态及版本信息以增强功能

* fix: 优化checkPkgUpdate和checkGitPluginUpdate函数,增强错误处理和返回结构

* fix: 更新checkPkgUpdate和checkGitPluginUpdate函数的返回值结构,增强错误处理和状态指示

* fix: 更新checkPkgUpdate函数的错误处理,确保错误信息类型为Error

* fix: 增强updatePkg和updateAllPkg函数的错误处理,确保异常情况被正确捕获并记录

* chore: 更新构建成功评论的安装命令,添加卸载步骤并支持开发依赖安装

* fix: 修正构建成功评论中的安装命令,确保正确的安装步骤

* feat: 添加提取指定版本号之间更新日志的功能

* fix: 重命名parseLog模块为changelog模块

* fix: 更新updatePkg和updateGitPlugin函数的返回类型,增强错误处理和返回信息

* chore: 将CHANGELOG.md添加到文件监视列表中

* fix: 更新updateAllGitPlugin函数,增加cmd参数以自定义更新命令

* feat: 添加console控制台适配器配置,更新相关文件路径和权限设置

* fix: 优化clearTemp函数,增加路径存在性检查以避免错误

* fix: 更新注册Bot日志信息,使用account.name替代adapter.name以提高可读性

* feat: 创建.pnpmfile.cjs文件,添加清空对等依赖中的node-karin的逻辑

* fix: 修复路径拼接错误,确保正确加载插件的package.json文件

* feat: 添加事件创建相关的类型和导出,优化适配器的成员信息处理

* refactor: 重构事件相关的导入路径,优化代码结构

* feat: 添加应用启动命令并更新事件类型,优化上下文处理

* fix: 简化配置文件保存逻辑,优化文件存在性检查

* feat: 添加get value属性到配置对象,优化数据访问方式

* refactor: 将配置对象中的get value属性重命名为get key,优化属性命名

* refactor: 更新配置对象中的get key属性注释,增强可读性

* refactor: 移除不必要的yaml导入,优化模块依赖

* refactor: 移除yaml函数的多余调用,简化代码结构

* refactor: 更新GroupMemberInfo接口中的role属性为必填,增强类型安全性

* chore: test ci

* chore: test ci

* chore: test ci

* chore: test ci

* chore: test ci

* chore: test ci

* chore: test ci

* =。=不玩了 不好玩

* =。=不行 我还要再试一下(这次看文档了!!!

* 再来

* 再来+1

* 再来+2

* 再来+3

* 再来+4

* chore: 移除调试信息 删除评论时的日志输出

* feat: 添加新的渲染重载以支持类型选项

* feat: 导出文件系统模块的命名空间以简化导入

* feat: 重构消息处理模块,调整 createRawMessage 的导入路径

* fix: 修正注释参数描述并优化注释添加逻辑

* fix: 初始化日志管理器以确保正确创建

* fix: 更新配置处理逻辑以缓存数据

* feat: 添加按钮处理器并更新事件参数类型

* feat: 重构按钮处理器,将其移至新文件并更新导出路径

* fix: 更新事件处理逻辑以返回事件对象

* banner

* banner

* fix: 更新配置文件处理逻辑,优化临时文件清理和函数命名

* feat: 启用文件嵌套功能并添加相关模式配置

* fix: 移除.gitignore中的子模块历史版本遗留条目

* test

* test1

* feat: 重构服务模块,添加调试功能并更新路径引用

* feat: 添加服务和工具模块的导入,更新配置文件和初始化逻辑,修改默认端口号为`7777`

* feat: 更换编译工具未`tsup`  dev模式修改为直接运行`ts`

* refactor: update project structure and configuration; remove unused files, adjust paths, and enhance build scripts

* refactor: 删除不再使用的脚本文件,更新依赖项和配置,优化错误处理逻辑

* feat: enhance project configuration and structure; add new type definitions, update build scripts, and improve plugin loading logic

* chore: update package.json scripts to use pnpm and modify GitHub Actions workflow for dependency installation and publishing

* chore: remove pnpm-lock.yaml from .gitignore to streamline package management

* feat: add compatibility check for @karinjs/karin-types; create index.d.ts if it doesn't exist

* refactor: update build scripts in package.json and improve type definition file handling in tsup.config.ts

* feat: export types

* feat: update exports in index.ts and add new ElementTypes in segment.ts

* feat: add export for adapter module in index.ts

* fix: DirectContact types

* feat: add export for root module in index.ts

* fix: command types

* fix: fix export

* refactor: 重构配置文件为`json`

* refactor: update user and group filtering logic to use new config structure

* chore: remove deprecated main entry files and related scripts

* refactor: update cooldown logic to handle optional properties and remove deprecated module exports

* fix: ensure authFailMsg defaults to true in LoaderPlugin

* feat: add web api

* fix: 修复初始化过快

* refactor: packages

* fix: build error

* fix: build logs

* fix: build error

* fix: fake

* fix: fake

* fix: 。。。

* fix: 6

* fix: cjs

* fix: build:cli

* fix: init

* fix: init

* fix: init workspace

* fix: wocao

* fix: 怪怪的

* fix: 不知道哪来的1

* refactor: update dependencies and improve CLI command execution

- Updated dependencies in `pnpm-lock.yaml` and `package.json` for core package, including:
  - `chalk` from 5.3.0 to 5.4.1
  - `commander` from 12.1.0 to 13.0.0
  - `dotenv` from 16.0.0 to 16.4.7
  - `level` from 8.0.1 to 9.0.0
  - `yaml` from 2.5.0 to 2.7.0
- Added new CLI command `dev:cli` for easier development.
- Refactored `exec.ts` to separate synchronous and asynchronous command execution.
- Removed deprecated `up.ts` file and updated import paths accordingly.

* fix: 修补正常启用脚本

* refactor: enhance CLI commands with environment variable support and improve logging

- Reorganized `package.json` to streamline CLI binary definitions.
- Added support for specifying environment variable files in CLI commands (`start`, `app`, `dev`, `ts`, `watch`).
- Improved error handling for missing environment files.
- Updated logging in the server to enhance readability.
- Adjusted debug mode detection to include a new environment variable.

* fix: start TypeError

* fix: 提高兼容性

* fix: 兼容性提高

* fix: npx

* fix: 兼容性提高

* fix: 应该使用依赖的版本号

* fix: 不要骂了~

* fix: 递归错误

* fix: class插件初始化错误

* fix: 兼容性提高

* fix: pm2 start

* fix: puppeteer

* feat: cli create-karin

---------

Co-authored-by: 时瑾 <74231782+shijinn520@users.noreply.github.com>
Co-authored-by: ikenxuan <2066855608@qq.com>
  • Loading branch information
3 people authored Jan 15, 2025
1 parent 4e4096e commit c8fb918
Show file tree
Hide file tree
Showing 333 changed files with 34,070 additions and 1,643 deletions.
14 changes: 13 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ij_any_space_before_colon = true
ij_any_space_after_colon = true
ij_any_keep_indents_on_empty_lines = false

[{*.cjs,*.js}]
[{*.cjs,*.js,*.ts}]
ij_javascript_align_imports = false
ij_javascript_use_semicolon_after_statement = false
ij_javascript_use_double_quotes = false
Expand All @@ -33,3 +33,15 @@ ij_json_space_before_colon = false
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false

[{*.yaml,*.yml}]
indent_size = 2
indent_style = space
tab_width = 2
insert_final_newline = true
trim_trailing_whitespace = true
ij_yaml_indent_mapping_value = true
ij_yaml_indent_sequence_value = true
ij_yaml_space_before_colon = false
ij_yaml_space_after_colon = true
ij_yaml_keep_indents_on_empty_lines = false
39 changes: 39 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
# packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency review'
on:
pull_request:
branches: [ "dev", "禁止强推、删除" ]

# If using a dependency submission action in this workflow this permission will need to be set to:
#
# permissions:
# contents: write
#
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
permissions:
contents: read
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
pull-requests: write

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
with:
comment-summary-in-pr: always
# fail-on-severity: moderate
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
# retry-on-snapshot-warnings: true
16 changes: 16 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Greetings

on: [pull_request_target, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "👋 你好!感谢你提交了第一个问题!🔍 你的细心帮助我们发现了新的改进机会,我们会尽快处理。🚀 如果你有更多的想法或疑问,请继续分享,我们非常乐意听取你的声音!🌟 感谢你的支持!"
pr-message: "🙌 你好,贡献者!感谢你提交的第一个拉取请求!🛠️ 你正在帮助我们打造更好的项目,我们会认真审查并与你一起优化它。💡 如果你有任何问题或需要帮助,随时联系!✨ 很高兴与你合作,欢迎成为我们社区的一员!"
27 changes: 27 additions & 0 deletions .github/workflows/issue_geetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
issues:
types: [labeled]

jobs:
create-comment:
runs-on: ubuntu-latest
steps:
- name: Create comment for enhancement
if: github.event.label.name == 'enhancement'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
body: |
你好 @${{ github.event.issue.user.login }},我们已经记录了你的新功能提议。如果你有任何具体的实现想法或设计草图,欢迎随时分享给我们。
emoji: 'eyes'

- name: Create comment for bug
if: github.event.label.name == 'bug'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
body: |
你好 @${{ github.event.issue.user.login }},看来我们的代码不小心打了个盹儿。别担心,我们已经唤醒了开发团队,他们正快马加鞭地赶来修复!🔨🐞
emoji: 'eyes'
20 changes: 20 additions & 0 deletions .github/workflows/issue_similarity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 问题相似性分析
name: Issues Similarity Analysis

on:
issues:
types: [opened, edited]

jobs:
similarity-analysis:
runs-on: ubuntu-latest
steps:
- name: analysis
uses: actions-cool/issues-similarity-analysis@v1
with:
filter-threshold: 0.5
comment-title: '### 似乎有相似的问题'
comment-body: '${index}. ${similarity} #${number}'
show-footer: false
show-mentioned: true
since-days: 730
17 changes: 17 additions & 0 deletions .github/workflows/issue_welcome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Issue Welcome

on:
issues:
types: [opened]

jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: 你好 @${{ github.event.issue.user.login }},我们注意到你是一次创建问题,感谢你的加入!我们非常期待你的想法和贡献。🌟
issue-emoji: 'eyes'
162 changes: 162 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: PR

# 监听 PR 相关事件
on:
pull_request:
# 监听 PR 被打开、重新打开和推送事件
types: [opened, reopened, synchronize]

# 赋予 release-please-action 权限
permissions:
contents: write
pull-requests: write
jobs:
# 设置 release-please 任务
release-please:
# 设置任务运行环境为 ubuntu-latest
runs-on: ubuntu-latest
defaults:
run:
# 为所有 run 步骤设置工作目录
working-directory: packages/core
steps:
- name: 检出代码
uses: actions/checkout@v4
# 设置 pnpm
- name: 设置 pnpm
uses: pnpm/action-setup@v2
with:
version: 8
# 设置 Node.js 环境
- name: 设置 Node.js 环境
uses: actions/setup-node@v4
with:
# 设置 Node.js 版本
node-version: 20
# 设置 npm 源
registry-url: "https://registry.npmjs.org"
# 添加 pnpm 缓存支持
cache: pnpm
# 使用 pnpm 安装依赖
- name: 安装依赖
run: pnpm install --no-frozen-lockfile
# 构建输出
- name: 构建输出
id: build
run: |
pnpm run build:prod > build.log 2>&1 || {
echo "构建失败,错误日志:"
cat build.log
exit 1
}
continue-on-error: true # 捕获失败并允许后续步骤运行
# 获取当前 PR 编号并设置环境变量
- name: 获取 PR 编号
id: get_pr
run: |
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV || {
echo "获取 PR 编号失败"
exit 1
}
continue-on-error: true
# 自动修改 package.json 的版本号、删除开发、对等依赖
- name: 修订版本号
id: version
run: |
pnpm run pr all || {
echo "修订版本号失败"
exit 1
}
continue-on-error: true
# 发布到 npm
- name: 发布到 npm
id: publish
run: |
# 检查 NPM_TOKEN 是否存在
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
echo "错误: NPM_TOKEN 未设置"
exit 1
fi
echo "NPM_TOKEN 长度: ${#NODE_AUTH_TOKEN}"
pnpm run pub-beta || {
echo "发布到 npm 失败"
exit 1
}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
continue-on-error: true
# 在 PR 上发布构建完成或失败信息
- name: 发布评论
run: |
# 收集所有步骤的状态
BUILD_STATUS="${{ steps.build.outcome }}"
PR_STATUS="${{ steps.get_pr.outcome }}"
VERSION_STATUS="${{ steps.version.outcome }}"
PUBLISH_STATUS="${{ steps.publish.outcome }}"
# 构建错误消息
ERROR_MESSAGE=""
if [ "$BUILD_STATUS" = "failure" ]; then
ERROR_MESSAGE+=$'构建步骤失败!\n'
ERROR_MESSAGE+=$(cat build.log || echo "未找到构建日志。")$'\n\n'
fi
if [ "$PR_STATUS" = "failure" ]; then
ERROR_MESSAGE+=$'获取 PR 编号失败!\n\n'
fi
if [ "$VERSION_STATUS" = "failure" ]; then
ERROR_MESSAGE+=$'修订版本号失败!\n\n'
fi
if [ "$PUBLISH_STATUS" = "failure" ]; then
ERROR_MESSAGE+=$'发布到 npm 失败!\n\n'
fi
if [ ! -z "$ERROR_MESSAGE" ]; then
# 发布错误信息评论
gh pr comment ${{ env.PR_NUMBER }} --body $'❌ 构建过程中出现错误!\n\n<details>\n<summary>展开查看错误日志</summary>\n\n```\n'"${ERROR_MESSAGE}"$'\n```\n\n</details>'
else
# 构建成功评论
INSTALL_COMMAND_1="pnpm rm ${{ env.PKG_NAME }} && pnpm install ${{ env.PKG_NAME }}@${{ env.PKG_VERSION }} -D"
INSTALL_COMMAND_2="pnpm install ${{ env.PKG_NAME }}@${{ env.PKG_VERSION }} -w"
gh pr comment ${{ env.PR_NUMBER }} --body $'🎉 构建完成!请不要使用此版本,正在重构中:\n\n```\n'"${INSTALL_COMMAND_1}"$'\n```\n\n```\n'"${INSTALL_COMMAND_2}"$'\n```'
fi
env:
GITHUB_TOKEN: ${{ secrets.RELEASE }}
# 撤回历史评论 保留最新的3条评论
- name: 撤回历史评论
run: |
# 获取当前PR的所有评论
comments=$(gh pr view ${{ env.PR_NUMBER }} --json comments)
# 过滤目标评论并按时间排序
target_comments=$(echo "$comments" | jq -r '.comments[] | select(.body | test("🎉 构建完成!|❌ 构建失败!|构建过程中出现错误")) | {url: .url, created_at: .createdAt}' | jq -s '. | sort_by(.created_at) | reverse')
# 获取需要删除的评论ID (保留最新的3条)
comment_ids_to_delete=$(echo "$target_comments" | jq -r 'if length > 3 then .[3:][] | .url | capture("#issuecomment-(?<id>\\d+)$").id else empty end')
# 删除旧评论
if [ ! -z "$comment_ids_to_delete" ]; then
for id in $comment_ids_to_delete; do
# 调试信息
echo "删除请求URL: /repos/${{ github.repository }}/issues/comments/$id"
response=$(curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.RELEASE }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-w "%{http_code}" \
-o /dev/null \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/$id")
if [ "$response" = "204" ]; then
echo "✓ 成功删除评论 $id"
else
echo "❌ 删除评论 $id 失败,HTTP状态码: $response"
exit 1
fi
done
else
echo "没有需要删除的历史评论"
fi
env:
GITHUB_TOKEN: ${{ secrets.RELEASE }}
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release and Publish
on:
push:
# 监听 dev 分支的 push 事件
branches:
- dev
# 赋予 release-please-action 权限
permissions:
contents: write
pull-requests: write
jobs:
# 设置 release-please 任务
release-please:
# 设置任务运行环境为 ubuntu-latest
runs-on: ubuntu-latest
steps:
# 使用 release-please-action 动作来自动创建发布 PR
- uses: googleapis/release-please-action@v4
id: release
with:
# 设置发布类型为 node
release-type: node
# 设置发布PR分支
default-branch: dev
# 检出代码
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# 设置 Node.js 环境
- uses: actions/setup-node@v4
with:
# 设置 Node.js 版本
node-version: 20
# 设置 npm 源
registry-url: "https://registry.npmjs.org"
# 安装依赖 不安装对等依赖
- run: npm install --config.auto-install-peers=false --ignore-scripts --omit=peer
env:
NODE_AUTH_TOKEN: ${{ secrets.RELEASE }}
if: ${{ steps.release.outputs.release_created }}
# 构建输出
- run: npm run build
if: ${{ steps.release.outputs.release_created }}
# 删除开发依赖、对等依赖
- run: npm run pr clean
if: ${{ steps.release.outputs.release_created }}
# 发布到 npm
- run: npm run pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
27 changes: 27 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
schedule:
- cron: '24 5 * * *'

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
Loading

0 comments on commit c8fb918

Please sign in to comment.