#!/usr/bin/env python3 import subprocess import datetime import os WEB_REPO = '../2009scape.github.io' NEWS_DIR = 'services/m=news/archives' LOG_DELIMITER = ';;;;;' DEBUG = False class Tag: def __init__(self, tag_name, last_tag): self.tag_name = tag_name self.last_tag = last_tag def make_tag() -> Tag: tag_name = datetime.datetime.now().strftime('%b-%d-%Y') print('new release tag:', tag_name) last_tag = subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).decode('utf8').strip() print('last release tag:', last_tag) if not DEBUG: subprocess.run(['git', 'tag', tag_name]) return Tag(tag_name, last_tag) def get_changelog_html(tag: Tag) -> str: if DEBUG: log_period = f'{tag.last_tag}..HEAD' else: log_period = f'{tag.last_tag}..{tag.tag_name}' changelog = subprocess.check_output(['git', 'log', log_period, f'--format=%B{LOG_DELIMITER}']).decode('utf8').split(LOG_DELIMITER) changelog_html = ''.join(['