diff --git a/git/export.php b/git/export.php index e5fdfbe..f21517f 100644 --- a/git/export.php +++ b/git/export.php @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/bin/env php {options} } // --- Variables -$reposPath = "ssh://git@192.168.78.249:10022/SCORES"; +$reposPath = "ssh://git@gitlab.factory.insight.doubletrade.com:scores"; $exportPath = '/home/vhosts/deploy/export'; define('COMPOSER_HOME', '/home/vhosts/deploy/composer'); @@ -50,9 +50,18 @@ if (file_exists($exportPath.'/'.$archiveProjet)) { if (file_exists($exportPath.'/'.$projet.'.tar')) { passthru('rm -rf '.$exportPath.'/'.$projet.'.tar'); } + +// Git Archive +/* passthru('git archive --remote='.$reposPath.'/'.$projet.'.git --prefix='.$archiveProjet.'/ -o '. $exportPath.'/'.$projet.'.tar '.$version); passthru('tar -xf '.$exportPath.'/'.$projet.'.tar --directory='.$exportPath); +passthru('rm -rf '.$exportPath.'/'.$projet.'.tar'); +*/ + +// Git clone - because GitLab doesn't support 'git archive' +passthru('git clone -q -b '.$version.' '.$reposPath.'/'.$projet.'.git '.$exportPath.'/'.$archiveProjet); +passthru('rm -rf '.$exportPath.'/'.$archiveProjet.'/.git'); if (!file_exists($exportPath.'/'.$archiveProjet)) { echo "Erreur\n"; exit(1); @@ -70,7 +79,6 @@ if (file_exists($exportPath.'/'.$archiveProjet.'/composer.lock')) { } } -passthru('rm -rf '.$exportPath.'/'.$projet.'.tar'); // --- Deploiement, pas de compression if (array_key_exists('deploy', $options)) { passthru('rm -rf '.$exportPath.'/'.$archiveProjet);