mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
120 lines
4.8 KiB
Plaintext
120 lines
4.8 KiB
Plaintext
---
|
||
dimensions:
|
||
type:
|
||
primary: operational
|
||
detail: deployment
|
||
level: intermediate
|
||
standard_title: Release to Individual GitHub Repo
|
||
language: zh
|
||
title: 发布至个人 GitHub 仓库
|
||
description: 本文档详细介绍了如何将Dify插件发布到个人的GitHub仓库中,包括准备工作、初始化本地插件仓库、连接远程仓库、上传插件文件、打包插件代码以及如何通过GitHub安装插件的完整流程。该方式允许开发者完全管理自己的插件代码和更新。
|
||
---
|
||
|
||
支持通过 GitHub 仓库链接安装插件。插件开发完成后,你可以选择将插件发布至公开 GitHub 仓库供其他人下载和使用。如果您还没有开发插件,可以参考[插件开发入门指南](/plugin-dev-zh/0211-getting-started-dify-tool)。
|
||
|
||
该方式具备以下优势:
|
||
|
||
• **个人管理**:你可以完全控制插件的代码和更新
|
||
|
||
• **快速分享**:通过 GitHub 链接即可轻松分享给其他用户或团队成员,便于测试和使用
|
||
|
||
• **协作与反馈**:将插件开源后,有可能会吸引 GitHub 上潜在的协作者,帮助您快速改进插件
|
||
|
||
本文将指导你如何将插件发布到 GitHub 仓库。
|
||
|
||
### 准备工作
|
||
|
||
首先要确认您已开发并测试了插件,并阅读了[插件开发基本概念](/plugin-dev-zh/0111-getting-started-dify-plugin)和[插件开发者准则](/plugin-dev-zh/0312-contributor-covenant-code-of-conduct)。在发布插件前,请确保您本地已安装以下工具:
|
||
|
||
* GitHub 账号
|
||
* 创建一个新的公开 GitHub 仓库
|
||
* 本地已安装 Git 工具
|
||
|
||
关于 GitHub 的基础知识,请参考 [GitHub 文档](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository)。
|
||
|
||
### 1. 完善插件项目
|
||
|
||
将上传至公开的 GitHub 意味着你将公开插件。请确保你已完成插件的调试和验证,并已完善插件的 `README.md` 文件说明。
|
||
|
||
建议说明文件包含以下内容:
|
||
|
||
* 插件的简介和功能描述
|
||
* 安装和配置步骤
|
||
* 使用示例
|
||
* 联系方式或贡献指南
|
||
|
||
### 2. 初始化本地插件仓库
|
||
|
||
将插件公开上传至 GitHub 之前,请确保已完成插件的调试和验证工作,详细请参考[远程调试插件](/plugin-dev-zh/0411-remote-debug-a-plugin)。在终端中导航到插件项目文件夹,并运行以下命令:
|
||
|
||
```bash
|
||
git init
|
||
git add .
|
||
git commit -m "Initial commit: Add plugin files"
|
||
```
|
||
|
||
如果你是第一次使用 Git,可能还需要配置 Git 用户名和邮箱:
|
||
|
||
```bash
|
||
git config --global user.name "Your Name"
|
||
git config --global user.email "your.email@example.com"
|
||
```
|
||
|
||
### 3. 连接远程仓库
|
||
|
||
使用以下命令,将本地仓库连接到 GitHub 仓库:
|
||
|
||
```bash
|
||
git remote add origin https://github.com/<your-username>/<repository-name>.git
|
||
```
|
||
|
||
### 4. 上传插件文件
|
||
|
||
> 打包插件前,请确保插件的 `manifest.yaml` 文件和 `/provider` 路径下的 `.yaml` 文件中的 author 字段与 GitHub ID 保持一致。关于清单文件的详细规范,请参考[通过清单文件定义插件信息](/plugin-dev-zh/0411-plugin-info-by-manifest)。
|
||
|
||
将插件项目推送到 GitHub 仓库:
|
||
|
||
```bash
|
||
git branch -M main
|
||
git push -u origin main
|
||
```
|
||
|
||
上传代码时建议附上标签,以便后续打包代码。
|
||
|
||
```bash
|
||
git tag -a v0.0.1 -m "Release version 0.0.1"
|
||
|
||
git push origin v0.0.1
|
||
```
|
||
|
||
### 5. 打包插件代码
|
||
|
||
前往 GitHub 代码仓库的 Releases 页,创建一个新的版本发布。发布版本时需上传插件文件。关于如何打包插件文件,详细说明请阅读[打包为本地文件与分享](/plugin-dev-zh/0322-release-by-file)。
|
||
|
||

|
||
|
||
### 通过 GitHub 安装插件
|
||
|
||
其他人可以通过 GitHub 仓库地址安装该插件。访问 Dify 平台的插件管理页,选择通过 GitHub 安装插件,输入仓库地址后,选择版本号和包文件完成安装。
|
||
|
||

|
||
|
||
## 相关资源
|
||
|
||
- [发布插件](/plugin-dev-zh/0321-release-overview) - 了解各种发布方式
|
||
- [打包为本地文件与分享](/plugin-dev-zh/0322-release-by-file) - 插件打包方法
|
||
- [通过清单文件定义插件信息](/plugin-dev-zh/0411-plugin-info-by-manifest) - 定义插件元数据
|
||
- [插件开发者准则](/plugin-dev-zh/0312-contributor-covenant-code-of-conduct) - 了解插件开发规范
|
||
- [远程调试插件](/plugin-dev-zh/0411-remote-debug-a-plugin) - 学习插件调试方法
|
||
|
||
{/*
|
||
Contributing Section
|
||
DO NOT edit this section!
|
||
It will be automatically generated by the script.
|
||
*/}
|
||
|
||
---
|
||
|
||
[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/plugin-dev-zh/0322-release-to-individual-github-repo.mdx) | [提交问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)
|
||
|