@@ -4,24 +4,36 @@ plugin_dir := "fulltext-attach-plugin"
44version :
55 @ cd {{ plugin_dir}} && python3 -c " from version import VERSION; print(VERSION)"
66
7- # Regenerate manifest.json, updates.json, and the local .xpi from version.py
7+ # Regenerate manifest.json, updates.json, and local .xpi from version.py
88build :
99 cd {{ plugin_dir}} && python3 build.py
1010
11- # Bump the minor version in version.py (standard release bump)
12- bump :
13- cd {{ plugin_dir}} && python3 bump_version.py minor
11+ # Bump version.py in-place
12+ _ bump bump_type :
13+ #!/usr/bin/env python3
14+ import re, sys
15+ from pathlib import Path
16+ path = Path(" {{ plugin_dir}} /version.py" )
17+ source = path.read_text()
18+ m = re.search(r' ^VERSION = "(\d+)\.(\d+)\.(\d+)"$' , source, re.MULTILINE)
19+ if not m:
20+ sys.exit(' Could not parse VERSION = "X.Y.Z" from version.py' )
21+ major, minor, patch = int(m.group(1 )), int(m.group(2 )), int(m.group(3 ))
22+ if " {{ bump_type}} " == " major" :
23+ major, minor, patch = major + 1 , 0, 0
24+ elif " {{ bump_type}} " == " minor" :
25+ minor, patch = minor + 1 , 0
26+ else :
27+ patch + = 1
28+ new = f " {major}.{minor}.{patch}"
29+ path.write_text(re.sub(r' ^VERSION = ".*"$' , f ' VERSION = "{new}"' , source, flags=re.MULTILINE))
30+ print(f " Bumped to {new}" )
1431
15- # Bump the major version in version.py
16- bump-major :
17- cd {{ plugin_dir}} && python3 bump_version.py major
18-
19- # Release a new minor version: bump, build, commit metadata, push, create GitHub Release with .xpi
20- release :
32+ # Build, commit metadata, push, and create a GitHub Release
33+ _ release bump_type : (_bump bump_type)
2134 #!/usr/bin/env bash
2235 set -euo pipefail
2336 cd {{ plugin_dir}}
24- python3 bump_version.py minor
2537 python3 build.py
2638 version=$(python3 -c " from version import VERSION; print(VERSION)" )
2739 xpi=" fulltext-attach-plugin-${version}.xpi"
@@ -35,21 +47,11 @@ release:
3547 " {{ plugin_dir}} /${xpi}#Zotero add-on (.xpi)"
3648 echo " Released v${version}: https://github.com/dzackgarza/zotero-attachment-plugin/releases/tag/v${version}"
3749
38- # Release a new major version: bump major, build, commit metadata, push, create GitHub Release
39- release-major :
40- #!/usr/bin/env bash
41- set -euo pipefail
42- cd {{ plugin_dir}}
43- python3 bump_version.py major
44- python3 build.py
45- version=$(python3 -c " from version import VERSION; print(VERSION)" )
46- xpi=" fulltext-attach-plugin-${version}.xpi"
47- cd ..
48- git add {{ plugin_dir}} / version.py {{ plugin_dir}} / manifest.json {{ plugin_dir}} / updates.json
49- git commit -m " chore: major release v${version}"
50- git push
51- gh release create " v${version}" \
52- - -title " v${version}" \
53- - -generate-notes \
54- " {{ plugin_dir}} /${xpi}#Zotero add-on (.xpi)"
55- echo " Released v${version}: https://github.com/dzackgarza/zotero-attachment-plugin/releases/tag/v${version}"
50+ # Release a patch version — bug fixes, infra, tooling (default)
51+ release : (_release " patch" )
52+
53+ # Release a minor version — new features or behaviour changes
54+ release-minor : (_release " minor" )
55+
56+ # Release a major version — breaking release line
57+ release-major : (_release " major" )
0 commit comments