Compare commits

...

5 Commits

Author SHA1 Message Date
Andrew Cassidy 8462861479 Fix readme 3 years ago
Andrew Cassidy d170e0b1e7 Version 1.0.0
### Changed

- Updated API for yaclog to 1.0.0
- Renamed '--input' option to '--path' for consistency with yaclog, and added an environment variable for its value
3 years ago
Andrew Cassidy 1861f7a4b6 Consistancy with yaclog 3 years ago
Andrew Cassidy d1dd6ce24b Automate github releases 3 years ago
Andrew Cassidy adc5c66067 Update yaclog API for in-dev version 3 years ago

@ -1,15 +1,13 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [ published ]
name: build
on: [ push, pull_request ]
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
@ -22,7 +20,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python -m pip install setuptools wheel twine
python -m pip install yaclog
- name: Install pypa/build
run: python -m pip install build --user
@ -30,7 +29,21 @@ jobs:
- name: Build a binary wheel and source tarball
run: python -m build --sdist --wheel --outdir dist/
- name: Get version name and body
run: |
echo "VERSION_TILE=Version $(yaclog show -n)" >> $GITHUB_ENV
echo "$(yaclog show -mb)" >> RELEASE.md
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish to Github
uses: softprops/action-gh-release@v1
with:
files: dist/*
name: ${{ env.VERSION_TITLE }}
body_path: RELEASE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file.
## 1.0.0 - 2021-05-07
### Changed
- Updated API for yaclog to 1.0.0
- Renamed '--input' option to '--path' for consistency with yaclog, and added an environment variable for its value
## 0.2.0 - 2021-05-06
### Changed
@ -10,6 +18,7 @@ All notable changes to this project will be documented in this file.
- Tweaks and fixes to project metadata in setup.cfg.
- Marked version compatibility with yaclog.
## 0.1.1 - 2021-04-16
yaclog-ksp is [now available on PyPi!](https://pypi.org/project/yaclog-ksp/)
@ -18,6 +27,7 @@ yaclog-ksp is [now available on PyPi!](https://pypi.org/project/yaclog-ksp/)
- Generator will now use change values instead of nodes when possible for more concise output files.
## 0.1.0 - 2021-04-16
First release

@ -1,5 +1,7 @@
# yaclog-ksp
[![PyPI version](https://badge.fury.io/py/yaclog-ksp.svg)](https://badge.fury.io/py/yaclog-ksp)
A command line tool based on [yaclog] for converting markdown changelogs to [KerbalChangelog] config files.
![a yak who is a log](https://github.com/drewcassidy/yaclog/raw/main/logo.png)
@ -18,9 +20,7 @@ Usage: yaclog-ksp [OPTIONS]
Converts markdown changelogs to KSP changelog configs.
Options:
-i, --input FILE Input markdown file to read from. [default:
CHANGELOG.md]
--path FILE Location of the changelog file. [default: CHANGELOG.md]
-o, --output FILE Output file to write to. Uses
'GameData/{name}/Versioning/{name}ChangeLog.cfg' by
default.
@ -30,10 +30,9 @@ Options:
--version Show the version and exit.
--help Show this message and exit.
```
for example, running `yaclog-ksp -i MyLog.md -n "My KSP Mod"`
for example, running `yaclog-ksp --path MyLog.md -n "My KSP Mod"`
would output to `GameData/MyKSPMod/Versioning/MyKSPModChangeLog.cfg`
Input files are in markdown, and use a certain syntax to be readable by the tool. Metadata is included in a table at the

@ -10,7 +10,7 @@ long_description_content_type = text/markdown
keywords = changelog, commandline, markdown, KSP
classifiers =
Development Status :: 4 - Beta
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: GNU Affero General Public License v3
Operating System :: OS Independent
@ -30,7 +30,7 @@ project_urls =
[options]
install_requires =
Click ~= 7.0
yaclog ~= 0.1
yaclog ~= 1.0
python_requires = >= 3.8
packages = find:

@ -23,17 +23,16 @@ from yaclog_ksp.cfgnode import ConfigNode
@click.command()
@click.option('-i', '--input', 'inpath',
default='CHANGELOG.md', show_default=True,
type=click.Path(readable=True, exists=True, dir_okay=False),
help="Input markdown file to read from.")
@click.option('--path', envvar='YACLOG_PATH', default='CHANGELOG.md', show_default=True,
type=click.Path(dir_okay=False, writable=True, readable=True),
help='Location of the changelog file.')
@click.option('-o', '--output', 'outpath',
default=None,
type=click.Path(writable=True, dir_okay=False),
help="Output file to write to. Uses 'GameData/{name}/Versioning/{name}ChangeLog.cfg' by default.")
@click.option('-n', '--name', help="The name of the mod. Derived from the current directory by default.")
@click.version_option()
def main(inpath, outpath, name):
def main(path, outpath, name):
""" Converts markdown changelogs to KSP changelog configs."""
if not name:
# try to guess name from current directory
@ -48,11 +47,11 @@ def main(inpath, outpath, name):
# default is in GameData/{name}/Versioning/{name}ChangeLog.cfg
outpath = pathlib.Path('GameData', modslug, 'Versioning', modslug + 'ChangeLog.cfg')
log = yaclog.read(inpath)
log = yaclog.read(path)
node = ConfigNode()
# find metadata table rows
for key, value in re.findall(r'^\|(?P<key>[^\n-]*?)\|(?P<value>[^\n-]*?)\|$', log.header, flags=re.MULTILINE):
for key, value in re.findall(r'^\|(?P<key>[^\n-]*?)\|(?P<value>[^\n-]*?)\|$', log.preamble, flags=re.MULTILINE):
key = key.strip()
value = value.strip()
if key.strip(':-'):

Loading…
Cancel
Save