A template for creating plugins using the PluginManager.Core framework. Clone this repository and customise it to create your own plugin.
-
Clone and rename
git clone https://github.com/CouncilOfTsukuyomi/PluginTemplate.git YourPluginName cd YourPluginName -
Follow the customisation steps below
-
Test your plugin
dotnet build dotnet test
-
Rename the folder
SamplePlugin→YourPluginName -
Update
PluginTemplate.sln
- Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj"
+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YourPluginName", "YourPluginName\YourPluginName.csproj"- Update the
.csprojfile
<PropertyGroup>
<AssemblyName>YourPluginName</AssemblyName>
<RootNamespace>YourPluginName</RootNamespace>
<AssemblyTitle>Sample Plugin</AssemblyTitle>
<AssemblyDescription>Sample Plugin For Atomos</AssemblyDescription>
<AssemblyCompany>Council of Tsukuyomi</AssemblyCompany>
<AssemblyProduct>PluginManager Sample Plugin</AssemblyProduct>
</PropertyGroup>In YourPluginName.cs, update the metadata section:
#region Plugin Metadata - CUSTOMIZE THESE VALUES
public override string PluginId => "your-unique-plugin-id";
public override string DisplayName => "Your Plugin Display Name";
public override string Description => "What your plugin does";
public override string Version => "1.0.0";
public override string Author => "Your Name";
#endregionIn plugin-manifest.json, update all the fields:
{
"pluginId": "sample-plugin",
"displayName": "Sample Plugin",
"description": "A simple sample plugin demonstrating the plugin architecture",
"version": "1.0.0",
"author": "Plugin Developer",
"website": "https://github.com/CouncilOfTsukuyomi/PluginTemplate",
"repositoryUrl": "https://github.com/CouncilOfTsukuyomi/PluginTemplate",
"assemblyName": "SamplePlugin.dll",
"mainClass": "SamplePlugin.SamplePlugin",
"iconUrl": "",
"tags": ["sample", "template", "example", "development"],
"category": "Development",
"featured": false,
"verified": true
}Featured and Verified don't mean anything currently
Add your required packages to both places:
-
In
YourPluginName.csproj:<ItemGroup> <PackageReference Include="YourPackage" Version="1.0.0" /> </ItemGroup>
-
In
plugin-manifest.json:"dependencies": [ { "name": "YourPackage", "version": "1.0.0" } ]
In plugin-manifest.json, update the configuration schema:
"configuration": {
"schema": {
"type": "object",
"properties": {
"ExampleSetting": {
"type": "string",
"default": "Hello World",
"title": "Example Setting",
"description": "An example configuration setting for the sample plugin"
},
"EnableLogging": {
"type": "boolean",
"default": true,
"title": "Enable Logging",
"description": "Whether to enable detailed logging for this plugin"
},
"MaxItems": {
"type": "integer",
"default": 100,
"minimum": 1,
"maximum": 1000,
"title": "Maximum Items",
"description": "Maximum number of items to process"
}
}
}
}In YourPluginName.cs, replace the sample implementation:
- Update
InitializeAsyncto handle your configuration - Update
FetchModsFromSourcewith your mod fetching logic - Update
GetModDownloadLinkAsyncwith your download link extraction
Customise the CI/CD workflows:
- release.yml - Handles plugin releases and publishing
- build-and-test.yml - Builds and tests the plugin on pull requests
-
Create repository secrets for GitHub App authentication:
APP_PRIVATE_KEY: Your GitHub App's private key
-
Create repository variables:
APP_ID: Your GitHub App's ID
If you are after manually pushing tag, remove these lines in the workflow
- name: Generate GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
token: ${{ steps.app-token.outputs.token }}
- name: "🏷️ Create and Push tag"
if: github.event_name == 'workflow_dispatch'
uses: EndBug/latest-tag@latest
with:
tag-name: ${{ github.event.inputs.version }}
description: "Release ${{ github.event.inputs.version }}"
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}- Update version in both
plugin-manifest.jsonand your plugin code - Push a version tag:
git tag v1.0.0 git push origin v1.0.0
- The release workflow will automatically build and publish your plugin
YourPluginName/YourPluginName.cs- Main plugin implementationYourPluginName/plugin-manifest.json- Plugin metadata and configurationYourPluginName/YourPluginName.csproj- Project dependencies.github/workflows/*.yml- CI/CD workflowsPluginTemplate.sln- Solution file