Refactor VectorSearchPlugin to remove minimum version check and add GitHub Actions workflow for releases

This commit is contained in:
ashwin271 2025-01-10 23:55:25 +05:30
parent 391cb33ce5
commit e352638183
2 changed files with 35 additions and 7 deletions

35
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Release Obsidian plugin
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
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

View file

@ -28,18 +28,11 @@ const DEFAULT_SETTINGS: MyPluginSettings = {
modelName: 'nomic-embed-text'
}
const MINIMUM_OBSIDIAN_VERSION = '0.15.0';
export default class VectorSearchPlugin extends Plugin {
settings: MyPluginSettings;
vectorStore: Map<string, number[]> = new Map();
async onload() {
// Version check
if (this.compareVersions(this.app.version, MINIMUM_OBSIDIAN_VERSION) < 0) {
new Notice(`Vector Search requires Obsidian ${MINIMUM_OBSIDIAN_VERSION} or higher`);
return;
}
await this.loadSettings();