From 337abc3db111de782c6cbd762e55612a3b41e90b Mon Sep 17 00:00:00 2001 From: Quentin Ferrand Date: Thu, 28 Apr 2022 20:14:02 +0200 Subject: [PATCH] bump version and retry drone full deply --- .drone.yml | 31 +++++++++++++++---------------- setup.py | 2 +- tenkan/files.py | 20 ++++++-------------- 3 files changed, 22 insertions(+), 31 deletions(-) diff --git a/.drone.yml b/.drone.yml index 728d3b0..6b1985d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,24 +33,23 @@ steps: password: from_secret: docker_password repo: takaoni/tenkan - tags: '1.3' + tags: ${'DRONE_COMMIT_SHA':0:8} dockerfile: docker/Dockerfile when: branch: - master -# - name: deploy_kube -# image: takaoni/drone-kube -# settings: -# template: apps/tenkan.yaml -# namespace: gemini -# server: -# from_secret: kube_server -# when: -# branch: -# - master - -host_aliases: - - ip: 192.168.0.210 - hostnames: - - git.fqserv.eu +- name: deploy_kube + image: sinlead/drone-kubectl + settings: + kubernetes_server: + from_secret: kube_url + kubernetes_cert: + from_secret: kube_cert + kubernetes_token: + from_secret: kube_token + commands: + - kubectl set image deployment/tenkan fqserv=takaoni/tenkan:${'DRONE_COMMIT_SHA':0:8} -n gemini + when: + branch: + - master diff --git a/setup.py b/setup.py index 42d7291..24476d3 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ here = os.path.abspath(os.path.dirname(__file__)) setup( name='tenkan', - version='0.1.5', + version='0.1.6', description='RSS/atom feed converter from html to gemini', python_requires='==3.*,>=3.8.0', project_urls={'repository': 'https://git.fqserv.eu/takaoni/tenkan'}, diff --git a/tenkan/files.py b/tenkan/files.py index e12c6f4..f3a73d9 100644 --- a/tenkan/files.py +++ b/tenkan/files.py @@ -62,9 +62,7 @@ def delete_folder(path: str, feed_name: str) -> None: shutil.rmtree(f'{path}{feed_name}') logging.info('%s/%s folder deleted', path, feed_name) else: - logging.info( - 'folder %s%s not present, nothing to delete', path, feed_name - ) + logging.info('folder %s%s not present, nothing to delete', path, feed_name) def index_file_write_header(path: str, title: str) -> None: @@ -80,9 +78,7 @@ def index_file_write_footer(path: str) -> None: index.write('\n=> atom.xml Atom feed\n') -def write_article( - article: dict, data: dict, path: str -) -> Dict[str, Union[bool, str]]: +def write_article(article: dict, data: dict, path: str) -> Dict[str, Union[bool, str]]: """Write individual article""" # prepare data for file format date = article['article_date'] @@ -93,9 +89,7 @@ def write_article( # we add the entry into index file with open(f'{path}/index.gmi', 'a') as index: - index.write( - f"=> {file_date}_{file_title}.gmi {date} - {article['article_title']}\n" - ) + index.write(f"=> {file_date}_{file_title}.gmi {date} - {article['article_title']}\n") new_file = False # write the file is it doesn't exist, obviously @@ -105,9 +99,7 @@ def write_article( # we write the entry file author = article['author'] if 'author' in article else None - pathlib.Path(f'{path}/{file_date}_{file_title}.gmi').write_text( - f"# {article['article_title']}\n\n=> {article['http_url']}\n\n{date}, {author}\n\n{content}" - ) + pathlib.Path(f'{path}/{file_date}_{file_title}.gmi').write_text(f"# {article['article_title']}\n\n=> {article['http_url']}\n\n{date}, {author}\n\n{content}") url = f"{data['gmi_url']}{data['title']}/{file_date}_{file_title}.gmi" return {'new_file': new_file, 'url': url} @@ -123,9 +115,9 @@ def _rebuild_atom_file(path: str, data: dict, urls: list) -> None: atomfeed.link(href=data['gmi_url'], rel='alternate') # rebuild all articles - for article in enumerate(data['articles']): + for art, article in enumerate(data['articles']): atomentry = atomfeed.add_entry() - url = urls[0] + url = urls[art] atomentry.guid(url) atomentry.link(href=url, rel='alternate') atomentry.updated(article['updated'])