Updated release script to use new website update post layout

This commit is contained in:
Bart Ribbers 2024-02-03 11:10:44 +00:00 committed by Ryan
parent b33517632e
commit 37a874f471

View file

@ -6,7 +6,7 @@ import os
WEB_REPO = '../2009scape.github.io' WEB_REPO = '../2009scape.github.io'
NEWS_DIR = 'services/m=news/archives' NEWS_DIR = 'updates/_posts'
LOG_DELIMITER = ';;;;;' LOG_DELIMITER = ';;;;;'
DEBUG = False DEBUG = False
@ -33,8 +33,8 @@ def get_changelog_html(tag: Tag) -> str:
else: else:
log_period = f'{tag.last_tag}..{tag.tag_name}' 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 = subprocess.check_output(['git', 'log', log_period, f'--format=%B{LOG_DELIMITER}']).decode('utf8').split(LOG_DELIMITER)
changelog_html = ''.join(['<li>' + change.strip().replace('\n', '<br />\n') + '</li>\n' for change in changelog if change.strip()]) changelog_html = ''.join(['- ' + change.strip().replace('\n', '<br />\n') + '\n' for change in changelog if change.strip()])
changelog_html = f'<ul>\n{changelog_html}</ul>' changelog_html = f'\n{changelog_html}'
print('generated changelog:', changelog_html, sep='\n') print('generated changelog:', changelog_html, sep='\n')
return changelog_html return changelog_html
@ -43,7 +43,7 @@ def make_news_post(tag: Tag) -> None:
changelog_html = get_changelog_html(tag) changelog_html = get_changelog_html(tag)
os.chdir(os.path.join(WEB_REPO, NEWS_DIR)) os.chdir(os.path.join(WEB_REPO, NEWS_DIR))
current_date = datetime.datetime.now().strftime('%Y-%m-%d') current_date = datetime.datetime.now().strftime('%Y-%m-%d')
news_filename = current_date + '.html' news_filename = f'{current_date}-More-changes-in-Gielinor.md'
print('news filename:', news_filename) print('news filename:', news_filename)
news_post = news_template(current_date, changelog_html) news_post = news_template(current_date, changelog_html)
if DEBUG: if DEBUG:
@ -56,111 +56,22 @@ def make_news_post(tag: Tag) -> None:
def news_template(current_date: str, changelog: str) -> str: def news_template(current_date: str, changelog: str) -> str:
return '''--- return f'''---
title: More Changes in Gielinor title: More changes in Gielinor
tags: news tags: news
layout: newspost layout: newspost
collection: Game Updates date: {current_date} 00:00:00 +0000
date: '''+ current_date + ''' 00:00:00 +0000
authors: ryannathans authors: ryannathans
excerpt: "There have been some more changes in Gielinor..." excerpt: "There have been some more changes in Gielinor..."
modtype: "Lead Developer"
avatar: avatar8fa9.gif
--- ---
<div id="content"> Greetings Explorers
<div id="article">
<div class="sectionHeader">
<div class="left">
<div class="right">
<h1 class="plaque">
{{ page.date | date: '%d-%B-%Y' }}
</h1>
</div>
</div>
</div>
<div class="section">
<div class="brown_background">
</div>
<div id="contrast_panel">
<div id="infopane">
<div class="title thrd">{{ page.title }}
</div>
</div>
<div class="phold" id="nocontrols"></div>
<div class="actions" id="top">
<table>
<tbody>
<tr>
<td class="commands center">
<ul class="flat first-child">
<li><a href="./archives.html"><img alt=""
src="../../../site/img/forum/cmdicons/backtoforum.gif"> Up to Legacy
Update List</a></li>
<li>
<a href=""><img alt="" src="../../../site/img/forum/cmdicons/refresh.gif">
Refresh</a>
</li>
</ul>
</td>
</tr>
<tr>
</tr>
</tbody>
</table>
</div>
<div class="" id="contentmsg">
<a class="msgplace" name="0"></a>
<table cellspacing="0" class="message jmod">
<tbody>
<tr>
<td class="leftpanel J-Mod">
<div class="msgcreator uname">
{{ page.authors }}
</div>
<img alt="" class="avatar" src="../../m=avatar-rs/avatar8fa9.gif">
<div class="modtype">???</div>
<div class="msgcommands">
<br> There have been some more changes in Gielinor:
</div>
</td> {changelog}
<td class="rightpanel"> '''
<div class="msgtime">
{{ page.date | date: '%d-%B-%Y' }}
<br>
</div>
<div class="msgcontents">
<p>Greetings Explorers</p>
<p>There have been some more changes in Gielinor:</p>''' + changelog + '''
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="actions" id="bottom">
<table>
<tbody>
<tr>
<td class="commands center">
<ul class="flat first-child">
<li><a href="./archives.html"><img alt=""
src="../../../site/img/forum/cmdicons/backtoforum.gif"> Up to Legacy
Update List</a></li>
<li>
<a href=""><img alt="" src="../../../site/img/forum/cmdicons/refresh.gif">
Refresh</a>
</li>
</ul>
</td>
</tr>
<tr>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>'''
def main() -> None: def main() -> None: