Files
dify-docs/plugin-dev-zh/0322-release-by-file.mdx
2025-06-03 11:06:43 +08:00

75 lines
3.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
dimensions:
type:
primary: operational
detail: deployment
level: intermediate
standard_title: Release by File
language: zh
title: 打包为本地文件与分享
description: 本文档介绍了如何将Dify插件项目打包为本地文件并分享给他人的详细步骤。内容包括插件打包前的准备工作、使用Dify插件开发工具执行打包命令、生成的.difypkg文件的安装方式以及如何分享插件文件给其他用户。
---
完成插件开发后,你可以将插件项目打包为一个本地文件并分享给他人,通过插件文件即可安装至 Dify Workspace 内。如果您还没有开发插件,可以参考[插件开发入门指南](/plugin-dev-zh/0211-getting-started-dify-tool)。
* **特点**
* 不依赖在线平台,**快速灵活**地分享插件。
* 适用于**私有插件**或**内部测试**。
* **发布流程**
* 将插件项目打包为本地文件。
* 在 Dify 插件页面上传文件安装插件。
本文将介绍如何将插件项目打包为本地文件,以及如何使用本地文件安装插件。
### 前置准备
* **Dify 插件开发工具**,详细说明请参考[初始化开发工具](/plugin-dev-zh/0221-initialize-development-tools)。
配置完成后,在终端输入 `dify version` 命令,检查是否输出版本号信息以确认已安装必要的开发工具。
### 打包插件
> 打包插件前,请确保插件的 `manifest.yaml` 文件和 `/provider` 路径下的 `.yaml` 文件中的 `author` 字段与 GitHub ID 保持一致。关于清单文件的详细信息,请参考[一般规范定义](/plugin-dev-zh/0411-general-specifications)。
插件项目开发完成后,请确保已完成[远程调试测试](/plugin-dev-zh/0411-remote-debug-a-plugin)。需前往插件项目的上一级目录,运行以下插件打包命令:
```bash
dify plugin package ./your_plugin_project
```
运行命令后将在当前路径下生成以 `.difypkg` 后缀结尾的文件。
![生成插件文件](https://assets-docs.dify.ai/2024/12/98e09c04273eace8fe6e5ac976443cca.png)
### 安装插件
访问 Dify 插件管理页,轻点右上角的**安装插件** → **通过本地文件**安装,或将插件文件拖拽至页面空白处安装插件。
![安装插件文件](https://assets-docs.dify.ai/2024/12/8c31c4025a070f23455799f942b91a57.png)
### 发布插件
你可以将插件文件分享给他人,或上传至互联网供他人下载。如果你希望更广泛地分享你的插件,可以考虑:
1. [发布至个人GitHub仓库](/plugin-dev-zh/0322-release-to-individual-github-repo) - 通过GitHub分享插件
2. [发布至Dify Marketplace](/plugin-dev-zh/0322-release-to-dify-marketplace) - 在官方市场发布插件
## 相关资源
- [发布插件](/plugin-dev-zh/0321-release-overview) - 了解各种发布方式
- [初始化开发工具](/plugin-dev-zh/0221-initialize-development-tools) - 配置插件开发环境
- [远程调试插件](/plugin-dev-zh/0411-remote-debug-a-plugin) - 学习插件调试方法
- [一般规范定义](/plugin-dev-zh/0411-general-specifications) - 定义插件元数据
- [插件开发入门指南](/plugin-dev-zh/0211-getting-started-dify-tool) - 从零开始开发插件
{/*
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-by-file.mdx) | [提交问题](https://github.com/langgenius/dify-docs/issues/new?title=文档问题%3A%20release-by-f&body=%23%23%20问题描述%0A%3C%21--%20请简要描述您发现的问题%20--%3E%0A%0A%23%23%20页面链接%0Ahttps%3A%2F%2Fgithub.com%2Flanggenius%2Fdify-docs%2Fblob%2Fmain%2Fplugin-dev-zh%2F0322-release-by-file.mdx%0A%0A%23%23%20建议修改%0A%3C%21--%20如果有具体的修改建议请在此说明%20--%3E%0A%0A%3C%21--%20感谢您对文档质量的关注%20--%3E)