From d965575f4a64f7dd9e2e18b2bb901dd5d4a50f6d Mon Sep 17 00:00:00 2001 From: Joao Moreira <13685125+jagmoreira@users.noreply.github.com> Date: Tue, 30 Oct 2018 19:05:31 -0500 Subject: [PATCH] Add current date when publishing with ghp tool. Re-submission of #2083 based on Invoke's task.py. --- pelican/tools/templates/tasks.py.jinja2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pelican/tools/templates/tasks.py.jinja2 b/pelican/tools/templates/tasks.py.jinja2 index d9645e19..f3049085 100644 --- a/pelican/tools/templates/tasks.py.jinja2 +++ b/pelican/tools/templates/tasks.py.jinja2 @@ -3,6 +3,7 @@ import os import shutil import sys +import datetime try: import socketserver except ImportError: @@ -29,6 +30,7 @@ CONFIG = { {% if github %} # Github Pages configuration 'github_pages_branch': '{{github_pages_branch}}', + 'commit_message': "'Publish site on {}'".format(datetime.date.today().isoformat()), {% endif %} # Port for `serve` 'port': 8000, @@ -108,7 +110,8 @@ def publish(c): @task def gh_pages(c): """Publish to GitHub Pages""" - rebuild(c) - c.run("ghp-import -b {github_pages_branch} {deploy_path} -p".format( - **CONFIG)) + preview(c) + c.run('ghp-import -b {github_pages_branch} ' + '-m {commit_message} ' + '{deploy_path} -p'.format(**CONFIG)) {% endif %}