diff --git a/scripts/create-release.bat b/scripts/create-release.bat deleted file mode 100644 index cf2c772..0000000 --- a/scripts/create-release.bat +++ /dev/null @@ -1,36 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -echo. -echo === Step 1: Typechecking... -call npm run typecheck -if %errorlevel% neq 0 ( - echo ERROR: Typechecking failed - exit /b %errorlevel% -) - -echo. -echo === Step 2: Building plugin... -call node esbuild.config.mjs production -if %errorlevel% neq 0 ( - echo ERROR: Build failed - exit /b %errorlevel% -) - -echo. -echo === Step 3: Getting version from package.json... -FOR /F "delims=" %%i IN ('node -p "require(\"./package.json\").version"') DO set VERSION=%%i -echo Detected version: %VERSION% - -echo. -echo === Step 4: Prompting for release notes... -set /p NOTES=Enter release notes: -echo Notes: %NOTES% - -echo. -echo === Step 5: Creating GitHub release (published)... -gh release create %VERSION% main.js manifest.json styles.css --title "%VERSION%" --notes "%NOTES%" - -echo. -echo Release v%VERSION% created and published! -pause diff --git a/scripts/full-release.bat b/scripts/full-release.bat deleted file mode 100644 index c11fa65..0000000 --- a/scripts/full-release.bat +++ /dev/null @@ -1,50 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -REM === Step 1: Choose version bump type === -echo. -set /p BUMP=Choose version bump (patch / minor / major): - -REM === Step 2: Run standard-version === -echo. -echo === Bumping version with standard-version --release-as %BUMP%... -npx standard-version --release-as %BUMP% -if %errorlevel% neq 0 ( - echo ERROR: Version bump failed - exit /b %errorlevel% -) - -REM === Step 3: Sync version to manifest.json === -echo. -echo === Syncing version to manifest.json... -node sync-version.js -if %errorlevel% neq 0 ( - echo ERROR: sync-version.js failed - exit /b %errorlevel% -) - -REM === Step 4: Commit manifest.json === -git add manifest.json -git commit -m "chore: sync version to manifest" --no-verify - -REM === Step 5: Push code and tags === -git push --follow-tags origin main - -REM === Step 6: Prompt for release notes === -echo. -set /p NOTES=Enter release notes: - -REM === Step 7: Get version number from package.json === -FOR /F "delims=" %%i IN ('node -p "require(\"./package.json\").version"') DO set VERSION=%%i -echo Detected version: v%VERSION% - -REM === Step 8: Create GitHub release === -gh release create v%VERSION% main.js manifest.json styles.css --title "v%VERSION%" --notes "%NOTES%" -if %errorlevel% neq 0 ( - echo ERROR: GitHub release failed - exit /b %errorlevel% -) - -echo. -echo โœ… Release v%VERSION% created and published! -pause diff --git a/scripts/release.bat b/scripts/release.bat new file mode 100644 index 0000000..a78555a --- /dev/null +++ b/scripts/release.bat @@ -0,0 +1,183 @@ +@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 \ No newline at end of file