From 3ebbfaf40c0a2e43a435c74e98f947c20c2f8f80 Mon Sep 17 00:00:00 2001 From: ShellWen Date: Wed, 29 Nov 2023 12:02:47 +0800 Subject: [PATCH 1/2] :memo: Add MkDocs as documentations. --- README.md | 126 +---------------------- docs/.gitignore | 2 + docs/docs/development.en.md | 3 + docs/docs/development.zh.md | 2 + docs/docs/getting-started.en.md | 3 + docs/docs/getting-started.zh.md | 48 +++++++++ docs/docs/index.en.md | 6 ++ docs/docs/index.zh.md | 98 ++++++++++++++++++ docs/mkdocs.yml | 91 ++++++++++++++++ docs/requirements.txt | 29 ++++++ examples/configs/custom-identifiers.toml | 49 +++++++++ examples/configs/simple.toml | 25 ----- 12 files changed, 335 insertions(+), 147 deletions(-) create mode 100644 docs/.gitignore create mode 100644 docs/docs/development.en.md create mode 100644 docs/docs/development.zh.md create mode 100644 docs/docs/getting-started.en.md create mode 100644 docs/docs/getting-started.zh.md create mode 100644 docs/docs/index.en.md create mode 100644 docs/docs/index.zh.md create mode 100644 docs/mkdocs.yml create mode 100644 docs/requirements.txt create mode 100644 examples/configs/custom-identifiers.toml diff --git a/README.md b/README.md index 5a67854..637a4f8 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@

A tool that can inject any js into the V8 VM
- Explore the docs » + Explore the docs »

Report Bug @@ -44,34 +44,10 @@

+ +## Documentations - - -
- Table of Contents -
    -
  1. - About The Project - -
  2. -
  3. - Getting Started - -
  4. -
  5. Usage
  6. -
  7. Roadmap
  8. -
  9. Contributing
  10. -
  11. License
  12. -
  13. Contact
  14. -
  15. Acknowledgments
  16. -
-
- +Documentations are available under [GitHub Pages](https://shellwen.github.io/v8-killer/). @@ -102,94 +78,11 @@ Pattern matching is on the way. [#12](https://github.com/ShellWen/v8_killer/issu

(back to top)

- - -### Built With - -* [![Rust][rust-badge]][rust-url] -* [![V8][v8-badge]][v8-url] - -

(back to top)

- - - ## Getting Started This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps. -### Prerequisites - -This is an example of how to list things you need to use the software and how to install them. -* rust - > Please follow Rust's official installation instructions: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) - -### Building - -1. Clone the repo - ```sh - git clone https://github.com/ShellWen/v8_killer.git - ``` -2. Run - ```sh - cargo build - ``` - to get a debug build, or - ```sh - cargo build --release - ``` - to get a release build. - -

(back to top)

- - - - -## Usage - -In short, you need pass environment variable `V8_KILLER_CONFIG_FILE_PATH` to the launcher, and the launcher will load the config file and inject the payload into the target program. -Here we use Node.js as an example. -```sh -V8_KILLER_CONFIG_FILE_PATH=path_to_config.toml v8_killer_launcher /usr/bin/node path_to_target.js -``` -Example config files can be found in the `examples/configs/` directory. -Currently, v8 killer only supports toml format config files. - -_For more examples, please refer to the [Wiki](https://github.com/ShellWen/v8_killer/wiki)_ - -

(back to top)

- - - - -## Roadmap - -WIP - -See the [open issues](https://github.com/ShellWen/v8_killer/issues) for a full list of proposed features (and known issues). - -

(back to top)

- - - - -## Contributing - -Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. - -If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". -Don't forget to give the project a star! Thanks again! - -1. Fork the Project -2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) -3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) -4. Push to the Branch (`git push origin feature/AmazingFeature`) -5. Open a Pull Request - -

(back to top)

- - - ## License @@ -208,17 +101,6 @@ Project Link: [https://github.com/ShellWen/v8_killer](https://github.com/ShellWe

(back to top)

- - - -## Acknowledgments - -* [ShellWen](https://github.com/ShellWen) - -

(back to top)

- - - [contributors-shield]: https://img.shields.io/github/contributors/ShellWen/v8_killer.svg?style=for-the-badge diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..6758400 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +/.venv/ +/site/ diff --git a/docs/docs/development.en.md b/docs/docs/development.en.md new file mode 100644 index 0000000..a85d196 --- /dev/null +++ b/docs/docs/development.en.md @@ -0,0 +1,3 @@ +We have not English version of this page yet. +Please refer to [Chinese version](/zh/development/) for now. +We welcome translation contributions. Please submit a Pull Request directly. diff --git a/docs/docs/development.zh.md b/docs/docs/development.zh.md new file mode 100644 index 0000000..33fa148 --- /dev/null +++ b/docs/docs/development.zh.md @@ -0,0 +1,2 @@ +## 构建 +TODO diff --git a/docs/docs/getting-started.en.md b/docs/docs/getting-started.en.md new file mode 100644 index 0000000..df4334c --- /dev/null +++ b/docs/docs/getting-started.en.md @@ -0,0 +1,3 @@ +We have not English version of this page yet. +Please refer to [Chinese version](/zh/getting-started/) for now. +We welcome translation contributions. Please submit a Pull Request directly. diff --git a/docs/docs/getting-started.zh.md b/docs/docs/getting-started.zh.md new file mode 100644 index 0000000..fc54425 --- /dev/null +++ b/docs/docs/getting-started.zh.md @@ -0,0 +1,48 @@ +本文假设你已经对相关的基础知识有所了解。 + +## 结构 +V8 Killer 分为 `core` 核心部分,与 `launcher` 启动器部分。 +前者为运行在目标进程中的部分,会在模块加载的时候 inline hook V8 引擎的编译相关函数,后者负责启动程序并将 `core` 加载进目标程序。 + +## 获取二进制文件 + +[//]: # (目前,我们提供预构建版本,发布在 [GitHub Releases][github-releases-url]{target=\_blank} 中) + +目前,我们不提供预构建版本,但你可以在 [GitHub Actions][github-actions-build-url]{target=\_blank} 中找到持续构建的二进制文件。 +如需自行构建,请参考 [开发](/zh/development)。 + +## 编写配置文件 + +配置文件是一个 [TOML][toml-url]{target=\_blank} 文件,其中包括了函数定位器与注入规则。 +我们目前暂时还未提供 TOML 文件的 JSON Schema,请参考 [/examples/configs][config-examples-url]{target=\_blank} 中给出的示例文件编写。 + +## 使用启动器启动 + +启动器会根据环境变量查找配置文件,你需要设置 `V8_KILLER_CONFIG_FILE_PATH` 环境变量,并将它的值指向配置文件的**绝对路径**。 + +### Linux / macOS +这是一段示例脚本,已在 Arch Linux 下测试通过: +```bash +#!/usr/bin/env bash +export V8_KILLER_CONFIG_FILE_PATH=/path/to/config/file/config.toml +v8_killer_launcher "/usr/bin/node" "/path/to/js/main.js" +``` + +### Windows +你可以通过 `PowerShell` 脚本,或 `cmd` 批处理启动 `launcher`: +```powershell +# PowerShell +$env:V8_KILLER_CONFIG_FILE_PATH = "C:\path\to\config\file\config.toml" +Start-Process -FilePath "C:\path\to\executable\node.exe" -ArgumentList "C:\path\to\js\main.js" -NoNewWindow +``` +```batch +:: cmd +set V8_KILLER_CONFIG_FILE_PATH=C:\path\to\config\file\config.toml +start "C:\path\to\executable\node.exe" "C:\path\to\js\main.js" +``` +请注意,在 Windows 中,允许配置全局环境变量,但我们不需要这么做,我们只需要在脚本中设置临时环境变量即可。 + +[toml-url]: https://toml.io/ +[github-releases-url]: https://github.com/ShellWen/v8_killer/releases +[github-actions-build-url]: https://github.com/ShellWen/v8_killer/actions/workflows/build.yaml +[config-examples-url]: https://github.com/ShellWen/v8_killer/tree/master/examples/configs diff --git a/docs/docs/index.en.md b/docs/docs/index.en.md new file mode 100644 index 0000000..0b1df8a --- /dev/null +++ b/docs/docs/index.en.md @@ -0,0 +1,6 @@ +# V8 Killer + +We have not English version of this page yet. +Please refer to [Chinese version](/zh/) for now. +We welcome translation contributions. Please submit a Pull Request directly. + diff --git a/docs/docs/index.zh.md b/docs/docs/index.zh.md new file mode 100644 index 0000000..f2a1269 --- /dev/null +++ b/docs/docs/index.zh.md @@ -0,0 +1,98 @@ +# V8 Killer +**强大**且可高度**自定义**的**通用** V8 虚拟机注入器。 + +[![Contributors][contributors-shield]][contributors-url]{target=\_blank} +[![Forks][forks-shield]][forks-url]{target=\_blank} +[![Stargazers][stars-shield]][stars-url]{target=\_blank} +[![Issues][issues-shield]][issues-url]{target=\_blank} +[![MIT License][license-shield]][license-url]{target=\_blank} +[![LinkedIn][linkedin-shield]][linkedin-url]{target=\_blank} + +## V8 Killer 是什么 + +该项目 ([V8 Killer][project-url]{target=\_blank}) 是由 [ShellWen][shellwen-github-url]{target=\_blank} 开发的 [V8 引擎][v8-url]{target=\_blank} +通用脚本注入方案,目前我们主要致力于解决 [Electron][electron-url]{target=\_blank} 程序的注入问题。 + +## Electron 注入方案比较 + +目前常见的 Electron 注入方案有以下几种: + +| | 开启调试端口 | 替换资源文件 | V8 Killer | +|-------------|------------------------------------|--------------------------|-------------------------------------------| +| 原理 | 通过特殊的命令行参数或运行时发送信号开启 Devtools 调试端口 | 替换存储在硬盘上的脚本文件 / asar 资源包 | 在程序运行后注入动态链接库 inline hook,修改 V8 引擎编译脚本的逻辑 | +| 可通过完整性检查 | ✅ | ❌ 修改文件会导致文件摘要值改变 | ✅ | +| 无安全性问题 | ❌ 调试端口无法添加保护,任何程序均可注入 | ✅ | ✅ 注入内容由配置文件指定,不对外暴露攻击面 | +| 更新版本后无需重新适配 | ✅ | ❌ | ⭕ 一般仅 Windows 平台需要 | +| 允许修改任意脚本 | ❌ | ✅ 支持对原脚本替换 | ✅ 支持对原脚本替换或**修改** | + +目前 V8 Killer 是唯一一个通用且不会破坏 Electron 程序完整性的注入方案。 + +V8 Killer 的缺点主要集中在以下几点: + +- Windows 平台下的 Electron 构建,默认会移除部分符号导出信息,所以需要自行逆向后填写相关函数的 EVA; +- 部分 Electron 程序可能会检查内存中加载的动态链接库列表,这会使得 V8 Killer 在目标程序中被发现。 + +## 开始使用 +请转到 [开始使用](/zh/getting-started)。 + +## 贡献 + +如果你发现了代码中存在的缺陷 / Bugs,欢迎你通过 [GitHub Issues][issues-url]{target=\_blank} 提交给我们,或是直接通过 +[GitHub Pull Requests][pull-requests-url]{target=\_blank} 将解决方案提交给我们。 +如果现有的代码无法满足你的需求,或是你有什么新的创意,你也可以通过 [GitHub Issues][issues-url]{target=\_blank} 告诉我们,但 +需要说明的是,项目维护者的精力有限,我们可能无法总是让你满意。 +文档翻译可能存在滞后性,也可能因疏忽而发生错误,如果遇到这种情况,烦请通过 [GitHub Issues][issues-url]{target=\_blank} 提交给我们。 +如果你对 Rust 有所了解,同时希望参与该项目的开发之中,请转到 [开发](/zh/development)。 + +## 社区 + +如果你在使用 V8 Killer 的时候碰到问题,请前往我们的讨论页 [GitHub Discussions][discussions-url]{target=\_blank}。 + +**请注意:GitHub Issues 仅用于提交代码缺陷 / Bugs,请不要把使用中的问题发到 Issues,这会分散开发人员的精力。** + +## 使用须知 & 免责声明 + +该项目仅供学习交流使用,禁止用于非法用途,否则后果自负。 +该项目不包含任何明示或暗示的用于任何目的的担保,本项目及其贡献者不对任何人使用本项目产生的任何直接或间接损失负责。 +该项目的使用者必须在遵守开源许可证的同时,仔细阅读并遵守本声明。 + +## 技术栈 + +该项目使用了一些来自社区的开源代码,我们对这些贡献者表示由衷的感谢: + +- [frida-rust](https://github.com/frida/frida-rust){target=\_blank} +- [lazy_static.rs](https://github.com/rust-lang-nursery/lazy-static.rs){target=\_blank} +- [rust-ctor](https://github.com/mmastrac/rust-ctor){target=\_blank} +- [toml-rs](https://github.com/toml-rs/toml){target=\_blank} +- [serde-rs](https://github.com/serde-rs/serde){target=\_blank} + +没有他们的贡献,该项目便无法顺利完成。再次感谢他们对开源界的贡献。 + +## 许可协议 + +该项目遵循 MIT 许可协议。具体请见项目根目录下的 [LICENSE 文件][license-url]{target=\_blank}。 + +[shellwen-github-url]: https://github.com/ShellWen +[project-url]: https://github.com/ShellWen/v8_killer +[contributors-shield]: https://img.shields.io/github/contributors/ShellWen/v8_killer.svg?style=for-the-badge +[contributors-url]: https://github.com/ShellWen/v8_killer/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/ShellWen/v8_killer.svg?style=for-the-badge +[forks-url]: https://github.com/ShellWen/v8_killer/network/members +[stars-shield]: https://img.shields.io/github/stars/ShellWen/v8_killer.svg?style=for-the-badge +[stars-url]: https://github.com/ShellWen/v8_killer/stargazers +[issues-shield]: https://img.shields.io/github/issues/ShellWen/v8_killer.svg?style=for-the-badge +[issues-url]: https://github.com/ShellWen/v8_killer/issues +[pull-requests-url]: https://github.com/ShellWen/v8_killer/pulls +[license-shield]: https://img.shields.io/github/license/ShellWen/v8_killer.svg?style=for-the-badge +[license-url]: https://github.com/ShellWen/v8_killer/blob/master/LICENSE +[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 +[linkedin-url]: https://linkedin.com/in/ShellWen + +[rust-badge]: https://img.shields.io/badge/Rust-000000?style=for-the-badge&logo=rust&logoColor=white +[rust-url]: https://www.rust-lang.org/ +[v8-badge]: https://img.shields.io/badge/V8-4B8BF5?style=for-the-badge&logo=v8&logoColor=white +[v8-url]: https://v8.dev/ + +[electron-url]: https://github.com/electron/electron + +[discussions-url]: https://github.com/ShellWen/v8_killer/discussions diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml new file mode 100644 index 0000000..6586fde --- /dev/null +++ b/docs/mkdocs.yml @@ -0,0 +1,91 @@ +# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json + +site_name: V8 Killer Docs +site_author: ShellWen +site_description: Official Documentation of V8 Killer + +repo_name: shellwen/v8_killer +repo_url: https://github.com/shellwen/v8_killer + +theme: + name: material + features: + - search.suggest + - search.highlight + - content.tabs.link + - navigation.indexes + - content.tooltips + - navigation.path + - content.code.annotate + - content.code.copy + - content.code.select + - navigation.tabs + - toc.follow + - toc.integrate + - navigation.top + palette: + - scheme: default + media: "(prefers-color-scheme: light)" + primary: deep orange + accent: orange + toggle: + icon: material/brightness-7 + # TODO: i18n + name: Switch to dark mode + + - scheme: slate + media: "(prefers-color-scheme: dark)" + primary: deep orange + accent: orange + toggle: + icon: material/brightness-4 + # TODO: i18n + name: Switch to light mode + +# noinspection YAMLSchemaValidation +plugins: + - search + - i18n: + docs_structure: suffix + languages: + - locale: en + default: true + name: en - English + build: true + - locale: zh + name: zh - 中文 + site_name: V8 Killer 文档 + site_description: V8 Killer 官方文档 + nav_translations: + Home: 主页 + Getting started: 开始使用 + Development: 开发 + theme: + palette: + - toggle: + name: 切换到深色模式 + - toggle: + name: 切换到浅色模式 + build: true + +nav: + - Home: index.md + - Getting started: getting-started.md + - Development: development.md + + +extra: + social: + - icon: fontawesome/brands/github-alt + link: https://github.com/ShellWen/v8_killer + alternate: + - link: / + lang: en + name: en - English + - link: /zh/ + lang: zh + name: zh - 汉语 + +# noinspection YAMLSchemaValidation +markdown_extensions: + - attr_list diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..ede3802 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,29 @@ +Babel==2.13.1 +certifi==2023.11.17 +charset-normalizer==3.3.2 +click==8.1.7 +colorama==0.4.6 +ghp-import==2.1.0 +idna==3.6 +Jinja2==3.1.2 +Markdown==3.5.1 +MarkupSafe==2.1.3 +mergedeep==1.3.4 +mkdocs==1.5.3 +mkdocs-material==9.4.14 +mkdocs-material-extensions==1.3.1 +mkdocs-static-i18n==1.2.0 +packaging==23.2 +paginate==0.5.6 +pathspec==0.11.2 +platformdirs==4.0.0 +Pygments==2.17.2 +pymdown-extensions==10.5 +python-dateutil==2.8.2 +PyYAML==6.0.1 +pyyaml_env_tag==0.1 +regex==2023.10.3 +requests==2.31.0 +six==1.16.0 +urllib3==2.1.0 +watchdog==3.0.0 diff --git a/examples/configs/custom-identifiers.toml b/examples/configs/custom-identifiers.toml new file mode 100644 index 0000000..992efee --- /dev/null +++ b/examples/configs/custom-identifiers.toml @@ -0,0 +1,49 @@ +# We have built-in default values for identifiers, but if you manually specify identifiers, +# we will not use the default values. So please ensure that you have **defined complete identifiers**. +[identifiers] +# There are two types of identifier: +# One is `symbol`, which automatically looks up the target function based on the symbol table; +# The other is `rva`, which directly specifies the function's RVA. +# Below, I provide their respective syntax. + +# The type of identifiers is an array, and we will match functions based on the order in the array. + +#V8_SCRIPT_COMPILER_COMPILE_FUNCTION_INTERNAL = [{ type = "symbol", symbols = [ +# """_ZN2v814ScriptCompiler23CompileFunctionInternalENS_5LocalINS_\ +# 7ContextEEEPNS0_6SourceEmPNS1_INS_6StringEEEmPNS1_INS_6ObjectEEE\ +# NS0_14CompileOptionsENS0_13NoCacheReasonEPNS1_INS_14ScriptOrModu\ +# leEEE""", +# """?CompileFunctionInternal@ScriptCompiler@v8@@CA?AV?$MaybeLocal\ +# @VFunction@v8@@@2@V?$Local@VContext@v8@@@2@PEAVSource@12@_KQEAV?\ +# $Local@VString@v8@@@2@2QEAV?$Local@VObject@v8@@@2@W4CompileOptio\ +# ns@12@W4NoCacheReason@12@PEAV?$Local@VScriptOrModule@v8@@@2@@Z"""] }] +V8_SCRIPT_COMPILER_COMPILE_FUNCTION_INTERNAL = [{ type = "rva", module_name = "node", rva = 0x00a3ffb0 }] +V8_STRING_UTF8LENGTH = [{ type = "symbol", symbols = [ + """_ZNK2v86String10Utf8LengthEPNS_7IsolateE""", + """?Utf8Length@String@v8@@QEBAHPEAVIsolate@2@@Z"""] }] +V8_STRING_WRITE_UTF8 = [{ type = "symbol", symbols = [ + """_ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii""", + """?WriteUtf8@String@v8@@QEBAHPEAVIsolate@2@PEADHPEAHH@Z"""] }] +V8_CONTEXT_GET_ISOLATE = [{ type = "symbol", symbols = [ + """_ZN2v87Context10GetIsolateEv""", + """?GetIsolate@Context@v8@@QEAAPEAVIsolate@2@XZ"""] }] +V8_STRING_NEW_FROM_UTF8 = [{ type = "symbol", symbols = [ + """_ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi""", + """?NewFromUtf8@String@v8@@SA?AV?$MaybeLocal@VString@v8@@@2@PEAV\ + Isolate@2@PEBDW4NewStringType@2@H@Z"""] }] + + +[rules.hook_console_log] +matcher = { type = "resource-name-keyword", keyword = "hello_world.js" } + +processors = [ + { type = "insert-before", content = """\ + const originalConsoleLog = console.log + console.log = function () { + originalConsoleLog('now you see :)') + return originalConsoleLog.apply(this, arguments) + }""" }, + { type = "insert-after", content = """\ + console.log = originalConsoleLog + """ } +] diff --git a/examples/configs/simple.toml b/examples/configs/simple.toml index 60b6d8a..79426f7 100644 --- a/examples/configs/simple.toml +++ b/examples/configs/simple.toml @@ -1,28 +1,3 @@ -[identifiers] -V8_SCRIPT_COMPILER_COMPILE_FUNCTION_INTERNAL = [{ type = "symbol", symbols = [ - """_ZN2v814ScriptCompiler23CompileFunctionInternalENS_5LocalINS_\ - 7ContextEEEPNS0_6SourceEmPNS1_INS_6StringEEEmPNS1_INS_6ObjectEEE\ - NS0_14CompileOptionsENS0_13NoCacheReasonEPNS1_INS_14ScriptOrModu\ - leEEE""", - """?CompileFunctionInternal@ScriptCompiler@v8@@CA?AV?$MaybeLocal\ - @VFunction@v8@@@2@V?$Local@VContext@v8@@@2@PEAVSource@12@_KQEAV?\ - $Local@VString@v8@@@2@2QEAV?$Local@VObject@v8@@@2@W4CompileOptio\ - ns@12@W4NoCacheReason@12@PEAV?$Local@VScriptOrModule@v8@@@2@@Z"""] }] -V8_STRING_UTF8LENGTH = [{ type = "symbol", symbols = [ - """_ZNK2v86String10Utf8LengthEPNS_7IsolateE""", - """?Utf8Length@String@v8@@QEBAHPEAVIsolate@2@@Z"""] }] -V8_STRING_WRITE_UTF8 = [{ type = "symbol", symbols = [ - """_ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii""", - """?WriteUtf8@String@v8@@QEBAHPEAVIsolate@2@PEADHPEAHH@Z"""] }] -V8_CONTEXT_GET_ISOLATE = [{ type = "symbol", symbols = [ - """_ZN2v87Context10GetIsolateEv""", - """?GetIsolate@Context@v8@@QEAAPEAVIsolate@2@XZ"""] }] -V8_STRING_NEW_FROM_UTF8 = [{ type = "symbol", symbols = [ - """_ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi""", - """?NewFromUtf8@String@v8@@SA?AV?$MaybeLocal@VString@v8@@@2@PEAV\ - Isolate@2@PEBDW4NewStringType@2@H@Z"""] }] - - [rules.hook_console_log] matcher = { type = "resource-name-keyword", keyword = "hello_world.js" } From 4a81a8dcefa0bd4c5d06ad63077a7932b962bef7 Mon Sep 17 00:00:00 2001 From: ShellWen Date: Wed, 29 Nov 2023 12:13:47 +0800 Subject: [PATCH 2/2] :construction_worker: Add CI for docs --- .github/workflows/documentations.yaml | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/documentations.yaml diff --git a/.github/workflows/documentations.yaml b/.github/workflows/documentations.yaml new file mode 100644 index 0000000..d085781 --- /dev/null +++ b/.github/workflows/documentations.yaml @@ -0,0 +1,44 @@ +name: Deploy docs to Pages + +on: + push: + branches: ["master"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.11 + cache: 'pip' + - name: Run pip install + run: pip install -r requirements.txt + working-directory: './docs' + - name: Build docs + run: mkdocs build + working-directory: './docs' + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: './docs/site' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2