feat: #1631: enable make command to support settings up release

Signed-off-by: Harsha Narayana <harsha2k4@gmail.com>
This commit is contained in:
Harsha Narayana 2019-07-24 05:03:04 +05:30
parent 3842eb36fd
commit 80b32d0c71
No known key found for this signature in database
GPG Key ID: 8AF211CB60D4B28C
3 changed files with 67 additions and 18 deletions

View File

@ -28,6 +28,12 @@ help:
@echo "docs-test"
@echo " Test Sanic Documentation for errors"
@echo ""
@echo "changelog"
@echo " Generate changelog for Sanic to prepare for new release"
@echo ""
@echo "release"
@echo " Prepare Sanic for a new changes by version bump and changelog"
@echo ""
clean:
@ -76,3 +82,13 @@ docs: docs-clean
docs-test: docs-clean
cd docs && make dummy
changelog:
python scripts/changelog.py
release: changelog
ifdef version
python scripts/release.py --release-version ${version}
else
python scripts/release.py
endif

View File

@ -7,7 +7,9 @@ if __name__ == "__main__":
import towncrier
import click
except ImportError:
print("Please make sure you have a installed towncrier and click before using this tool")
print(
"Please make sure you have a installed towncrier and click before using this tool"
)
exit(1)
@click.command()
@ -16,9 +18,12 @@ if __name__ == "__main__":
"draft",
default=False,
flag_value=True,
help="Render the news fragments, don't write to files, " "don't check versions.",
help="Render the news fragments, don't write to files, "
"don't check versions.",
)
@click.option(
"--dir", "directory", default=path.dirname(path.abspath(__file__))
)
@click.option("--dir", "directory", default=path.dirname(path.abspath(__file__)))
@click.option("--name", "project_name", default=None)
@click.option(
"--version",
@ -34,9 +39,21 @@ if __name__ == "__main__":
flag_value=True,
help="Do not ask for confirmation to remove news fragments.",
)
def _main(draft, directory, project_name, project_version, project_date, answer_yes):
def _main(
draft,
directory,
project_name,
project_version,
project_date,
answer_yes,
):
return towncrier.__main(
draft, directory, project_name, project_version, project_date, answer_yes
draft,
directory,
project_name,
project_version,
project_date,
answer_yes,
)
_main()

View File

@ -254,6 +254,7 @@ def release(args: Namespace):
new_version=new_version,
config_file=args.config,
)
if args.tag_release:
_tag_release(
current_version=current_version,
new_version=new_version,
@ -291,13 +292,13 @@ if __name__ == "__main__":
"--token",
"-t",
help="Git access token with necessary access to Huge Sanic Org",
required=True,
required=False,
)
cli.add_argument(
"--milestone",
"-ms",
help="Git Release milestone information to include in relase note",
required=True,
required=False,
)
cli.add_argument(
"--release-name",
@ -313,6 +314,21 @@ if __name__ == "__main__":
action="store_true",
required=False,
)
cli.add_argument(
"--tag-release",
help="Tag a new release for Sanic",
default=False,
action="store_true",
required=False,
)
args = cli.parse_args()
if args.tag_release:
for key, value in {
"--token/-t": args.token,
"--milestone/-m": args.milestone,
}.items():
if not value:
print(f"{key} is mandatory while using --tag-release")
exit(1)
with Directory():
release(args)