@echo off setlocal enabledelayedexpansion echo. echo ================================================ echo Obsidian Macros Plugin Release Script echo ================================================ echo. REM === Step 1: Choose version bump type === echo ================================================ echo VERSION BUMP GUIDELINES echo ================================================ echo. echo ๐Ÿ”ง PATCH (x.x.X) - Bug fixes and small improvements: echo โ€ข ๐Ÿ› Bug fixes echo โ€ข ๐Ÿ”ง Performance improvements echo โ€ข ๐Ÿ“ Documentation updates echo โ€ข ๐ŸŽจ UI/UX tweaks (no functionality changes) echo โ€ข ๐ŸŒ Adding translations/localization echo โ€ข ๐Ÿงน Code cleanup/refactoring echo โ€ข ๐Ÿ”’ Security patches echo. echo โœจ MINOR (x.X.0) - New features (backward compatible): echo โ€ข โœจ New features or commands echo โ€ข ๐ŸŽ›๏ธ New settings/configuration options echo โ€ข ๐Ÿ“Š New chart types or visualization options echo โ€ข ๐Ÿ”Œ New integrations (APIs, plugins) echo โ€ข โšก New shortcuts or hotkeys echo โ€ข ๐Ÿ“ฑ New UI components or views echo โ€ข ๐ŸŽฏ Enhancements to existing features echo. echo ๐Ÿ’ฅ MAJOR (X.0.0) - Breaking changes: echo โ€ข ๐Ÿ’ฅ Removing features or commands echo โ€ข ๐Ÿ”„ Changing existing behavior significantly echo โ€ข ๐Ÿ“ Changing data formats or file structures echo โ€ข โš™๏ธ Changing configuration format echo โ€ข ๐Ÿ”ง Changing how the plugin is used fundamentally echo โ€ข ๐Ÿšซ Dropping support for Obsidian versions echo. echo ================================================ echo Quick Decision: Breaking changes? โ†’ MAJOR echo New features? โ†’ MINOR echo Fixes/improvements? โ†’ PATCH echo ================================================ echo. set /p BUMP=Choose version bump type (patch/minor/major): REM Validate input if /i "%BUMP%"=="patch" goto :valid_bump if /i "%BUMP%"=="minor" goto :valid_bump if /i "%BUMP%"=="major" goto :valid_bump echo ERROR: Invalid bump type. Please use 'patch', 'minor', or 'major' pause exit /b 1 :valid_bump echo. echo ================================================ echo Step 1/8: Running type check... echo ================================================ call npm run typecheck if %errorlevel% neq 0 ( echo ERROR: Type checking failed. Please fix errors before releasing. pause exit /b %errorlevel% ) echo. echo ================================================ echo Step 2/8: Bumping version (%BUMP%)... echo ================================================ npx standard-version --release-as %BUMP% if %errorlevel% neq 0 ( echo ERROR: Version bump failed pause exit /b %errorlevel% ) echo. echo ================================================ echo Step 3/8: Syncing version to manifest.json... echo ================================================ node sync-version.js if %errorlevel% neq 0 ( echo ERROR: Failed to sync version to manifest.json pause exit /b %errorlevel% ) echo. echo ================================================ echo Step 4/8: Building plugin for production... echo ================================================ call node esbuild.config.mjs production if %errorlevel% neq 0 ( echo ERROR: Production build failed pause exit /b %errorlevel% ) echo. echo ================================================ echo Step 5/8: Committing manifest.json... echo ================================================ git add manifest.json git commit -m "chore: sync version to manifest" --no-verify if %errorlevel% neq 0 ( echo WARNING: Commit may have failed (might be nothing to commit) ) echo. echo ================================================ echo Step 6/8: Getting version information... echo ================================================ FOR /F "delims=" %%i IN ('node -p "require(\"./package.json\").version"') DO set VERSION=%%i echo Current version: %VERSION% echo. echo ================================================ echo Step 7/8: Pushing to GitHub... echo ================================================ echo Pushing code and tags to origin/main... git push --follow-tags origin main if %errorlevel% neq 0 ( echo ERROR: Failed to push to GitHub pause exit /b %errorlevel% ) echo. echo ================================================ echo Step 8/8: Creating GitHub release... echo ================================================ echo. echo Please provide release notes for version %VERSION%: echo (Press Enter twice when finished) echo. REM Collect multi-line release notes set "NOTES=" set "line=" :input_loop set /p line="> " if "!line!"=="" ( if defined NOTES ( goto :done_input ) ) else ( if defined NOTES ( set "NOTES=!NOTES! !line!" ) else ( set "NOTES=!line!" ) ) goto :input_loop :done_input echo. echo Creating GitHub release %VERSION%... gh release create %VERSION% main.js manifest.json styles.css --title "%VERSION%" --notes "!NOTES!" if %errorlevel% neq 0 ( echo ERROR: Failed to create GitHub release echo You can manually create it later with: echo gh release create %VERSION% main.js manifest.json styles.css --title "%VERSION%" --notes "!NOTES!" pause exit /b %errorlevel% ) echo. echo ================================================ echo ๐ŸŽ‰ RELEASE SUCCESSFUL! ๐ŸŽ‰ echo ================================================ echo. echo โœ… Version bumped to: %VERSION% echo โœ… Plugin built for production echo โœ… Code pushed to GitHub echo โœ… GitHub release created echo. echo Your plugin release v%VERSION% is now live! echo Users can update through Obsidian's Community Plugins tab. echo. pause