mirror of
https://github.com/kevinmcaleer/obsidian-bases-chart.git
synced 2026-07-22 06:06:19 +00:00
- Rename plugin ID to bases-chart - Rewrite README with full SQL reference and all chart types - Fix mobile layout (wrapping type buttons, stacking form rows) - Move title below settings panel header - Add GitHub Actions release workflow - Add npm run release script for version bumping - Remove auto-bump from esbuild config - Remove "Obsidian" from plugin description per submission requirements
51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
/**
|
|
* Bump version, commit, tag, and push — triggering the GitHub Actions release workflow.
|
|
*
|
|
* Usage:
|
|
* npm run release # bumps patch (1.0.0 → 1.0.1)
|
|
* npm run release minor # bumps minor (1.0.0 → 1.1.0)
|
|
* npm run release major # bumps major (1.0.0 → 2.0.0)
|
|
* npm run release 1.2.3 # sets exact version
|
|
*/
|
|
import { readFileSync, writeFileSync } from 'fs';
|
|
import { execSync } from 'child_process';
|
|
|
|
const arg = process.argv[2] || 'patch';
|
|
|
|
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
const manifest = JSON.parse(readFileSync('manifest.json', 'utf8'));
|
|
const oldVersion = pkg.version;
|
|
|
|
let newVersion;
|
|
if (/^\d+\.\d+\.\d+$/.test(arg)) {
|
|
newVersion = arg;
|
|
} else {
|
|
const parts = oldVersion.split('.').map(Number);
|
|
if (arg === 'major') { parts[0]++; parts[1] = 0; parts[2] = 0; }
|
|
else if (arg === 'minor') { parts[1]++; parts[2] = 0; }
|
|
else { parts[2]++; }
|
|
newVersion = parts.join('.');
|
|
}
|
|
|
|
pkg.version = newVersion;
|
|
manifest.version = newVersion;
|
|
|
|
writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n');
|
|
|
|
console.log(`Version: ${oldVersion} → ${newVersion}`);
|
|
|
|
// Build
|
|
console.log('Building...');
|
|
execSync('npm run build', { stdio: 'inherit' });
|
|
|
|
// Git commit + tag + push
|
|
console.log('Committing and tagging...');
|
|
execSync('git add package.json manifest.json', { stdio: 'inherit' });
|
|
execSync(`git commit -m "Release ${newVersion}"`, { stdio: 'inherit' });
|
|
execSync(`git tag ${newVersion}`, { stdio: 'inherit' });
|
|
|
|
console.log('Pushing...');
|
|
execSync('git push && git push --tags', { stdio: 'inherit' });
|
|
|
|
console.log(`\nReleased ${newVersion} — GitHub Actions will create the release.`);
|