10 Commits
1.1.1 ... 1.2.0

Author SHA1 Message Date
47d4b595f8 Release Version 1.2.0
### Added

- added the `-s` option to `yaclog release` to increment arbitrary version segments 
- added the `-n` option to `yaclog release` to create a new release instead of releasing a new one
- added the `-y` option to `yaclog release` to answer "yes" to all confirmation dialogs. Use with caution!
2024-04-15 23:49:30 -07:00
fdf30bc14c also make -y apply to git commit confirmations 2024-04-15 23:49:14 -07:00
72126c8dca Add -s, -n, and -y options to release 2024-04-15 23:45:24 -07:00
0666f7f593 Release Version 1.1.2
### Changed

- yaclog now only tries to use git when invoked with a command that needs it, meaning most sub commands can now be used on systems without git
2022-12-29 00:34:58 -08:00
51e28e4ef0 cleanup 2022-12-29 00:34:27 -08:00
a7cbacb687 Update changelog 2022-12-28 20:49:58 -08:00
3fa529a05c Bump actions/setup-python from 4.3.1 to 4.4.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.1 to 4.4.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.3.1...v4.4.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-27 20:26:05 -08:00
396960fae0 Only import toml and gitpython when necessary
Allows for using most commands on platforms without git installed (like the a-shell app on ios where gitpython doesnt quite work)
2022-12-27 20:21:18 -08:00
c661be05dc Bump actions/setup-python from 4.2.0 to 4.3.1
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.2.0 to 4.3.1.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.2.0...v4.3.1)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-12 23:34:48 -08:00
2f4124c0fc Test with python 3.11 2022-12-12 23:33:48 -08:00
4 changed files with 51 additions and 13 deletions

View File

@ -9,14 +9,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
click-version: [ "click~=7.0", "click~=8.0" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.4.0
with:
python-version: ${{ matrix.python-version }}
@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4.2.0
uses: actions/setup-python@v4.4.0
with:
python-version: '3.x'

View File

@ -2,6 +2,22 @@
All notable changes to this project will be documented in this file
## Version 1.2.0 - 2024-04-16
### Added
- added the `-s` option to `yaclog release` to increment arbitrary version segments
- added the `-n` option to `yaclog release` to create a new release instead of releasing a new one
- added the `-y` option to `yaclog release` to answer "yes" to all confirmation dialogs. Use with caution!
## Version 1.1.2 - 2022-12-29
### Changed
- yaclog now only tries to use git when invoked with a command that needs it, meaning most sub commands can now be used on systems without git
## Version 1.1.1 - 2022-08-15
### Fixed

View File

@ -153,6 +153,11 @@ class TestRelease(unittest.TestCase):
self.assertEqual(yaclog.read(location).versions[0].name, '1.0.1')
self.assertIn('1.0.1', result.output)
result = runner.invoke(cli, ['release', '-y', '-s', 2])
check_result(self, result)
self.assertEqual(yaclog.read(location).versions[0].name, '1.0.2')
self.assertIn('1.0.2', result.output)
runner.invoke(cli, ['entry', '-b', 'entry number 3'])
result = runner.invoke(cli, ['release', '-m'])
@ -194,6 +199,12 @@ class TestRelease(unittest.TestCase):
self.assertEqual(yaclog.read(location).versions[0].name, '3.0.0')
self.assertIn('3.0.0', result.output)
result = runner.invoke(cli, ['release', '-p', '-n'])
check_result(self, result)
self.assertEqual(yaclog.read(location).versions[0].name, '3.0.1')
self.assertEqual(yaclog.read(location).versions[1].name, '3.0.0')
self.assertIn('3.0.1', result.output)
def test_commit(self):
"""Test committing and tagging releases"""
runner = CliRunner()

View File

@ -16,10 +16,8 @@
import datetime
import os.path
from ..cli import cargo_toml
import click
import git
import yaclog.version
from yaclog.changelog import Changelog
@ -52,7 +50,7 @@ def init(obj: Changelog):
click.echo(f'Created new changelog file at {obj.path}')
@cli.command('format') # dont accidentally hide the `format` python builtin
@cli.command('format') # don't accidentally hide the `format` python builtin
@click.pass_obj
def reformat(obj: Changelog):
"""Reformat the changelog file."""
@ -189,6 +187,8 @@ def entry(obj: Changelog, bullets, paragraphs, section_name, version_name):
help='Increment minor version number.')
@click.option('-p', '--patch', 'rel_seg', flag_value=2, type=int,
help='Increment patch number.')
@click.option('-s', '--segment', 'rel_seg', type=int,
help='Increment nth segment of the version. For example, `--segment 2` is equivalent to `--patch`')
@click.option('-a', '--alpha', 'pre_seg', flag_value='a', type=str, default=None,
help='Increment alpha version number.')
@click.option('-b', '--beta', 'pre_seg', flag_value='b', type=str,
@ -202,9 +202,13 @@ def entry(obj: Changelog, bullets, paragraphs, section_name, version_name):
'If there are no changes to commit, the current commit will be tagged instead.')
@click.option('-C', '--cargo', '-🦀', is_flag=True,
help='Update the version in a Rust cargo.toml manifest file.')
@click.option('-y', '--yes', is_flag=True,
help='Answer "yes" to all confirmation dialogs')
@click.option('-n', '--new', is_flag=True,
help = 'Create a new version instead of renaming an existing one')
@click.argument('version_name', metavar='VERSION', type=str, default=None, required=False)
@click.pass_obj
def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo):
def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo, yes, new):
"""
Release VERSION, or a version incremented from the last release.
@ -220,7 +224,10 @@ def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo):
click.echo('Nothing to release!')
raise click.Abort
cur_version = obj.current_version()
if new:
cur_version = obj.add_version()
else:
cur_version = obj.current_version()
old_name = cur_version.name
if version_name:
@ -237,11 +244,11 @@ def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo):
new_name = yaclog.version.increment_version(new_name, rel_seg, pre_seg)
if new_name != old_name:
if yaclog.version.is_release(old_name):
if yaclog.version.is_release(old_name) and not yes:
click.confirm(
f"Rename release version {click.style(old_name, fg='blue')} "
f"to {click.style(new_name, fg='blue')}?",
abort=True)
f"Rename release version {click.style(old_name, fg='blue')} "
f"to {click.style(new_name, fg='blue')}?",
abort=True)
cur_version.name = new_name
cur_version.date = datetime.datetime.utcnow().date()
@ -254,10 +261,12 @@ def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo):
short_version = cur_version.name.replace(' ', '-')
if cargo:
from ..cli import cargo_toml
cargo_toml.set_version("Cargo.toml", str(short_version))
click.echo("Updated Cargo.toml")
if commit:
import git
repo = git.Repo(os.curdir)
if repo.bare:
@ -283,7 +292,8 @@ def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo):
f"You have {untracked} untracked file{'s'[:untracked]} that will not be included!",
fg='red', bold=True))
click.confirm(' '.join(message), abort=True)
if not yes:
click.confirm(' '.join(message), abort=True)
if tracked > 0:
commit = repo.index.commit(f'Release {cur_version.name}\n\n{cur_version.body()}')
@ -291,6 +301,7 @@ def release(obj: Changelog, version_name, rel_seg, pre_seg, commit, cargo):
else:
commit = repo.head.commit
# noinspection PyTypeChecker
repo_tag = repo.create_tag(short_version, ref=commit, message=cur_version.body(False))
click.echo(f"Created tag {click.style(repo_tag.name, fg='green')}.")