mirror of
https://github.com/rbrauner/obsidian-header-filename.git
synced 2026-07-22 08:33:32 +00:00
32 lines
842 B
Bash
Executable file
32 lines
842 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
VERSION="${1:?Usage: create-version <version>}"
|
|
|
|
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
echo "Invalid version: $VERSION (expected format: X.Y.Z)"
|
|
exit 1
|
|
fi
|
|
|
|
# update manifest.json
|
|
node -e "
|
|
const fs = require('fs');
|
|
const m = JSON.parse(fs.readFileSync('manifest.json', 'utf8'));
|
|
m.version = '$VERSION';
|
|
fs.writeFileSync('manifest.json', JSON.stringify(m, null, '\t') + '\n');
|
|
"
|
|
|
|
# update package.json
|
|
node -e "
|
|
const fs = require('fs');
|
|
const p = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
p.version = '$VERSION';
|
|
fs.writeFileSync('package.json', JSON.stringify(p, null, ' ') + '\n');
|
|
"
|
|
|
|
git add manifest.json package.json
|
|
git commit -m "v$VERSION"
|
|
git tag "$VERSION"
|
|
git push origin main --tags
|
|
|
|
echo "Released v$VERSION"
|