]> git.agnieray.net Git - galette.git/commitdiff
Set release version in nigthly
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 18 May 2020 11:30:08 +0000 (13:30 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 18 May 2020 11:30:08 +0000 (13:30 +0200)
bin/release

index 6a1b0c8bd8c6241390125f13e569d93967de1573..71c1b121ea020fec356117a15bed5885a1a96d0e 100755 (executable)
@@ -22,6 +22,7 @@ sign = True
 assume_yes = False
 nightly = False
 ssh_key = False
+nightly_version = None
 
 def print_err(msg):
     """
@@ -303,6 +304,7 @@ def do_scp(archive):
 def add_libs(rel_name, galette_archive):
     """
     Add external libraries to the archive
+    Also write version for GALETTE_NIGHTLY value
     """
     galette = tarfile.open(galette_archive, 'r|bz2')
     src_dir = os.path.join(local_dl_repo, 'src')
@@ -311,18 +313,29 @@ def add_libs(rel_name, galette_archive):
     galette.extractall(path=src_dir)
     galette.close()
 
+    #set galette nightly version
+    includes_dir = os.path.join(src_dir, rel_name, 'galette', 'includes')
+    sed_cmd = 'sed -e "s/GALETTE_NIGHTLY\', false/GALETTE_NIGHTLY\', \'%s\'/" -i galette.inc.php' % nightly_version
+    print(sed_cmd)
+    p1 = subprocess.Popen(sed_cmd, shell=True, cwd=includes_dir)
+    p1.wait()
+
+    #install npm modules
     npm_dir = os.path.join(src_dir, rel_name)
     npm_cmd = 'npm install --prefix %s' % npm_dir
     print(npm_cmd)
     p1 = subprocess.Popen(npm_cmd, shell=True, cwd=npm_dir)
     p1.wait()
 
+    #run gulp install script for assets
     wp_cmd = 'npm run-script gulp build'
     p1 = subprocess.Popen(wp_cmd, shell=True, cwd=npm_dir)
     p1.wait()
 
+    #node modules are no longer needed
     shutil.rmtree(os.path.join(npm_dir, 'node_modules'))
 
+    #install php dependencies
     composer_cmd = 'composer install --no-dev'
     composer_dir = os.path.join(src_dir, rel_name, 'galette')
     print(composer_dir)
@@ -418,14 +431,21 @@ def add_libs(rel_name, galette_archive):
 def valid_commit(repo, c):
     """
     Validate commit existance in repository
+    Also prepare version for GALETTE_NIGHTLY value
     """
-    global commit
+    global commit, nightly_version
 
     try:
         dformat = '%a, %d %b %Y %H:%M'
         repo_commit = repo.commit(c)
 
         commit = repo_commit.hexsha[:10]
+
+        nightly_version = '%s (%s)' % (
+            commit,
+            time.strftime('%Y-%m-%d %H:%M:%S GMT%z', time.localtime(repo_commit.authored_date)),
+        )
+
         print(colored("""Commit information:
         Hash:          %s
         Author:        %s