diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 12c3fd43..f8938434 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -40,7 +40,7 @@ jobs: - name: Update Changelog uses: docker://ghcr.io/nonebot/auto-changelog:master with: - changelog_file: website/src/pages/changelog.md + changelog_file: website/src/changelog/changelog.md latest_changes_position: '# 更新日志\n\n' latest_changes_title: "## 最近更新" replace_regex: '(?<=## 最近更新\n)[\s\S]*?(?=\n## )' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d3ea293..075b81cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: - name: Archive Changelog uses: docker://ghcr.io/nonebot/auto-changelog:master with: - changelog_file: website/src/pages/changelog.md + changelog_file: website/src/changelog/changelog.md archive_regex: '(?<=## )最近更新(?=\n)' archive_title: ${{ env.TAG_NAME }} commit_and_push: false diff --git a/CHANGELOG.md b/CHANGELOG.md index c30ff5f2..95ba3ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ # Changelog -See [changelog.md](./website/src/pages/changelog.md) or +See [changelog.md](./website/src/changelog/changelog.md) or diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index 0809ba98..73b11898 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -1,4 +1,5 @@ import type { Config } from "@docusaurus/types"; +import type { Options as ChangelogOptions } from "@nullbot/docusaurus-plugin-changelog"; import type * as Preset from "@nullbot/docusaurus-preset-nonepress"; import { themes } from "prism-react-renderer"; @@ -327,7 +328,17 @@ export default async function createConfigAsync() { }), }, - plugins: [require("./src/plugins/webpack-plugin.ts")], + plugins: [ + require("./src/plugins/webpack-plugin.ts"), + [ + "@nullbot/docusaurus-plugin-changelog", + { + changelogPath: "website/src/pages/changelog.md", + changelogHeader: `description: Changelog +toc_max_heading_level: 2`, + } satisfies ChangelogOptions, + ], + ], markdown: { mdx1Compat: { diff --git a/website/package.json b/website/package.json index c4a75e95..ce6fe5d7 100644 --- a/website/package.json +++ b/website/package.json @@ -24,6 +24,7 @@ "dependencies": { "@docusaurus/core": "^3.5.2", "@mdx-js/react": "^3.0.0", + "@nullbot/docusaurus-plugin-changelog": "^3.0.0", "@nullbot/docusaurus-preset-nonepress": "^3.0.0", "@swc/core": "^1.7.26", "clsx": "^2.0.0", diff --git a/website/src/pages/changelog.md b/website/src/changelog/changelog.md similarity index 100% rename from website/src/pages/changelog.md rename to website/src/changelog/changelog.md diff --git a/yarn.lock b/yarn.lock index 56408772..09cf7fc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1915,6 +1915,16 @@ resolved "https://registry.npmjs.org/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz#3dc35ba0f1e66b403c00b39344f870298ebb1c8e" integrity sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA== +"@nullbot/docusaurus-plugin-changelog@^3.0.0": + version "3.0.2" + resolved "https://registry.npmjs.org/@nullbot/docusaurus-plugin-changelog/-/docusaurus-plugin-changelog-3.0.2.tgz#057490577b9d3c7a897e32e80c54a92e991be5b6" + integrity sha512-nlGed3F4eXvTwxsgNxa4S2E2MtBK4yWNCaCBDKFebTSpaBVIZKXA+ZPP1mqLTODW66TzYKfTATTeKqjwvdqb/A== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/plugin-content-docs" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" + fs-extra "^11.2.0" + "@nullbot/docusaurus-plugin-docsmenu@^3.0.2": version "3.0.2" resolved "https://registry.npmjs.org/@nullbot/docusaurus-plugin-docsmenu/-/docusaurus-plugin-docsmenu-3.0.2.tgz#598e85e992dba696e8914eb2c9e3db4afc228cd3"