diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0e1c60b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +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 \ No newline at end of file diff --git a/main.ts b/main.ts index e8f0424..27e5745 100644 --- a/main.ts +++ b/main.ts @@ -11,8 +11,6 @@ import OpenAI from "openai"; import { ChatCompletionCreateParamsBase } from "openai/resources/chat/completions"; import { getClient, getReplacement } from "utils/openai"; -// Remember to rename these classes and interfaces! - interface AutogenSettings { openaiApiKey: string; model: ChatCompletionCreateParamsBase["model"]; @@ -65,15 +63,9 @@ export default class Autogen extends Plugin { const content = editor.getValue(); const windowSize = 5000; - console.log("Editor change: ", content); - - // Execute pattern search once instead of looping const match = pattern.exec(content); if (match !== null) { - console.log("Found match:", match[0]); - - // Calculate window around the match const start = Math.max(match.index - windowSize / 2, 0); const end = Math.min( match.index + match[0].length + windowSize / 2, @@ -81,7 +73,6 @@ export default class Autogen extends Plugin { ); const textWindow = content.substring(start, end); - console.log("Text window: ", textWindow); const onConfirm = async (modal: Modal) => { modal.contentEl.empty(); @@ -150,7 +141,6 @@ export default class Autogen extends Plugin { } replaceText(editor: Editor, match: string, replacement: string) { - // replace the match with the replacement const content = editor.getValue(); const newContent = content.replace(match, replacement); editor.setValue(newContent); diff --git a/manifest.json b/manifest.json index 2e476a5..da69d82 100644 --- a/manifest.json +++ b/manifest.json @@ -4,8 +4,8 @@ "version": "1.0.0", "minAppVersion": "0.15.0", "description": "In place autogeneration of content based on prompts.", - "author": "Obsidian", + "author": "Aidan Tilgner", "authorUrl": "https://github.com/AidanTilgner", "fundingUrl": "https://www.buymeacoffee.com/aidantilgner", - "isDesktopOnly": false + "isDesktopOnly": true }