Skip to content

Commit

Permalink
github_deploy writes lastdeploy file
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed May 21, 2015
1 parent 28be7f6 commit f7e5152
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -10,6 +10,7 @@ Features
Bugfixes
--------

* github_deploy records lastdeploy timestamp like regular deploy
* Don’t check the same remote URL more than once (Issue #1732)
* All remotely checked links resulted in incorrect warnings (`nikola check -lr`)
* Exclude `<meta content="noindex" name="robots">` from sitemaps
Expand Down
12 changes: 11 additions & 1 deletion nikola/plugins/command/github_deploy.py
Expand Up @@ -25,14 +25,15 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import print_function
from datetime import datetime
import os
import subprocess
import sys
from textwrap import dedent

from nikola.plugin_categories import Command
from nikola.plugins.command.check import real_scan_files
from nikola.utils import get_logger, req_missing
from nikola.utils import get_logger, req_missing, makedirs, unicode_str
from nikola.__main__ import main
from nikola import __version__

Expand Down Expand Up @@ -119,3 +120,12 @@ def _commit_and_push(self):
'returned {1}'.format(e.cmd, e.returncode)
)
sys.exit(e.returncode)

self.logger.info("Successful deployment")

# Store timestamp of successful deployment
timestamp_path = os.path.join(self.site.config["CACHE_FOLDER"], "lastdeploy")
new_deploy = datetime.utcnow()
makedirs(self.site.config["CACHE_FOLDER"])
with io.open(timestamp_path, "w+", encoding="utf8") as outf:
outf.write(unicode_str(new_deploy.isoformat()))

0 comments on commit f7e5152

Please sign in to comment.