changeset 992:bd269692dbb4

cm: Make the release script commit changed FoodTruck assets if needed.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 12 May 2017 09:01:51 -0700
parents 5e3e840b5574
children 86266f0198d2
files garcon/pypi.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/garcon/pypi.py	Sun Oct 29 23:13:12 2017 -0700
+++ b/garcon/pypi.py	Fri May 12 09:01:51 2017 -0700
@@ -1,3 +1,4 @@
+import re
 from invoke import task, run
 
 
@@ -14,12 +15,25 @@
     print("Generating FoodTruck assets")
     run("gulp")
 
+    # See if any asset was modified and needs to be submitted.
+    r = run('hg status', hide=True)
+    if re.match(r'^[R\!] ', r.stdout):
+        raise Exception("FoodTruck assets are missing or were removed!")
+
+    commit_assets = False
+    if re.match(r'^[MA] ', r.stdout):
+        commit_assets = True
+
     # CHANGELOG.rst and documentation changelog page.
     run("invoke changelog --last %s" % version)
     run("invoke changelog --last %s -o docs/pages/support/changelog.md" %
             version)
 
     if not local_only:
+        if commit_assets:
+            run('hg commit piecrust/admin/static '
+                '-m "admin: Regenerate FoodTruck assets."')
+
         # Submit the CHANGELOG.
         run('hg commit CHANGELOG.rst docs/pages/support/changelog.md '
             '-m "cm: Regenerate the CHANGELOG."')
@@ -31,6 +45,8 @@
         run("python setup.py version")
         run("python setup.py sdist upload")
     else:
+        if commit_assets:
+            print("Would submit FoodTruck assets...")
         print("Would submit changelog files...")
         print("Would tag repo with %s..." % version)
         print("Would upload to PyPi...")