Try building a zip of the release

remotes/remote_mirror_8/master
Mike Koch 7 years ago
parent cc900a16da
commit 5a908d6b61

@ -5,8 +5,16 @@ before_script:
test:app:
#when: manual
before_script:
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php
- php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- php composer.phar install
script:
- cd api/Tests
- phpunit
- cd ../../ci
- php deploy_release_to_github.php
- bash build_zip.sh
#- php deploy_release_to_github.php

@ -0,0 +1,18 @@
#!/bin/bash
cd ../
mkdir release-temp
TARGETDIR='release-temp';for file in *;do test "$file" != "$TARGETDIR" && cp -r "$file" "$TARGETDIR/";done
# Remove files that we don't want to bundle
cd release-temp
rm -rf ci
#rm .gitignore
#rm .gitlab-ci.yml
rm -rf .git
rm apidoc.json
rm CONTRIBUTING.md
cd ../
zip -r release.zip release-temp
rm -rf release-temp

@ -1,2 +1,49 @@
<?php
var_dump(scandir('.'));
$zip_name = "release.zip";
if (!extension_loaded("zip")) {
die("Cannot zip file contents!");
}
$zip = new ZipArchive();
$res = $zip->open($zip_name, ZipArchive::CREATE);
if ($res !== true) {
die("Failed to create zip!\n");
}
// Create recursive directory iterator
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator("../"),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
echo "\nWorking with file " . $file->getFilename() . "\n";
continue;
if (substr($file->getFilename(), 0, strlen($file->getFilename())) === "." ||
strtolower($file->getFilename()) === 'attachments' ||
strtolower($file->getFilename()) === "contributing.md" ||
strtolower($file->getFilename() === "ci") ||
strtolower($file->getFilename() === "apidoc.json")) {
//-- Don"t compress . files
echo "Skipped file.\n";
continue;
}
// Skip directories (they would be added automatically)
if (!$file->isDir())
{
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen("../") + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
} else {
echo "Skipped directory " . $file->getFilename() . "\n";
}
}
Loading…
Cancel
Save