Obsidian Pluginのtemplateからレポジトリを作成する
templateから新規レポジトリを作る
Info
cloneだとこれまでの履歴も入ってくるので注意
開発する
- manifest.json https://github.com/obsidianmd/obsidian-api に説明がある
{
"id": "sample-plugin",
"name": "Sample Plugin", プラグインの表示名
"version": "1.0.0", versionの作者
"minAppVersion": "0.15.0", プラグインに最低限必要なObsidianのバージョン(調べ方)
"description": "Demonstrates some of the capabilities of the Obsidian API.", プラグインの長い説明
"author": "Obsidian", プラグインの作者
"isDesktopOnly": false プラグインがNode or electron apiを利用しているかどうか
"authorUrl": "https://obsidian.md", 自分のwebsiteのURL(option)
"fundingUrl": "https://obsidian.md/pricing", buy a coffee 用のURL(option)
}
パッケージの更新
- git のタグ打ち・push
git tag -a 1.0.0 -m "1.0.0"
git push origin 1.0.0これは難しい気がするな
- version.jsonの更新
- タグと対応するobsidianのversionをjson形式で追加する
- manifest.jsonの更新
- version,minAppVersionの更新
Github Actionsを利用したプラグインのリリース
https://docs.obsidian.md/Plugins/Releasing/Release+your+plugin+with+GitHub+Actions レポジトリのリリースに載せる
.github/workflowsでymlファイルをおく- setting → actions → general → workflow permissionsで「read and write permissionsにしてsave」
- 登録後タグがpushされるたびにリリースされる
- 実際にリリースノートを書いて公開する必要がある
name: Release Obsidian plugin
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Build plugin
run: |
npm install
npm run build
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}"
gh release create "$tag" \
--title="$tag" \
--draft \
main.js manifest.json styles.css
Pluginの登録
https://docs.obsidian.md/Plugins/Releasing/Submit+your+plugin
確かにこれは指圧が多くなって厳しいのは感じる 2回目以降 自動的にリリースされる
bratでのインストール
- bratをcommunity pluginからインストール
Add beta pluginでレポジトリを指定するとインストール可能