diff --git a/justfile b/justfile new file mode 100644 index 0000000..6581502 --- /dev/null +++ b/justfile @@ -0,0 +1,43 @@ +_default: + @just -l --unsorted + +install: + git submodule update + make package + code --install-extension kanata.vsix + +# Updates kanata to latest git + adds notice about it to CHANGELOG.md +bump_kanata: + #!/bin/sh + git submodule update --remote && + cd kanata && + HASH=$(git rev-parse --short HEAD) && + echo "$HASH" && + cd .. && + # Exit early without updating changelog if a bump notice was already added in "Unreleased" section. + ! grep -q "$HASH" CHANGELOG.md && + sed '/Updated kanata to/Id' CHANGELOG.md && + just add_to_changelog "Updated kanata to [$HASH]\(https://github.com/jtroo/kanata/tree/$HASH\)" + +# Bumps version number, pushes a "new version" commit/tags, builds, uploads to VS Code marketplace. +release VERSION: + just _ensure_clean_directory + + git checkout main + git pull + git checkout -b release-v{{VERSION}} + sed -i 's/\"version\": \"[^\"]*\"/\"version\": \"{{VERSION}}\"/' package.json + sed -i 's/### Unreleased/### Unreleased\n\n* no changes yet\n\n### {{VERSION}}/' CHANGELOG.md + git push + + git tag v{{VERSION}} + git push --tags + + # vsce publish {{VERSION}} + +add_to_changelog TEXT: + sed -i '/no changes yet/Id' CHANGELOG.md + sed -i "N;s/^### Unreleased\n/\0\n\* {{TEXT}}/" CHANGELOG.md + +_ensure_clean_directory: + git diff-index --quiet HEAD -- \ No newline at end of file