Versienummer automatisch verhogen bij elke commit (1.1.1)
- VERSION bevat het versienummer, config.py leest het daaruit (werkt ook in Docker, waar config.ini niet meegaat) - verhoog_versie.py: laatste cijfer +1 tot 99, dan het middelste; het middelste ook tot 99, dan het eerste - CLAUDE.md: Claude verhoogt de versie voor elke commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
51b016d8fb
commit
6e78b2e790
4 files changed
+62
-1
No files matched your search
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
Verhoogt het versienummer in VERSION met één stap. Uitvoeren vóór elke commit:
|
||||
|
||||
python verhoog_versie.py
|
||||
|
||||
Regels: het laatste cijfer gaat telkens één omhoog, tot 99.
|
||||
1.1.0 -> 1.1.1
|
||||
1.1.99 -> 1.2.0
|
||||
1.99.99 -> 2.0.0 (het eerste cijfer heeft geen maximum)
|
||||
"""
|
||||
import os
|
||||
|
||||
PAD = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION')
|
||||
MAX = 99
|
||||
|
||||
|
||||
def volgende(versie):
|
||||
hoofd, sub, patch = (int(x) for x in versie.strip().split('.'))
|
||||
patch += 1
|
||||
if patch > MAX:
|
||||
patch, sub = 0, sub + 1
|
||||
if sub > MAX:
|
||||
sub, hoofd = 0, hoofd + 1
|
||||
return f"{hoofd}.{sub}.{patch}"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open(PAD, encoding='utf-8') as f:
|
||||
oud = f.read().strip()
|
||||
nieuw = volgende(oud)
|
||||
with open(PAD, 'w', encoding='utf-8') as f:
|
||||
f.write(nieuw + '\n')
|
||||
print(f"{oud} -> {nieuw}")
|
||||
Reference in new issue
Block a user