Create Nextcloud release builder for #96

This commit is contained in:
the-djmaze 2022-10-11 11:52:48 +02:00
parent bdca1f4ff6
commit 63ef2cc724
5 changed files with 50 additions and 5 deletions

40
build/nextcloud.php Executable file
View file

@ -0,0 +1,40 @@
<?php
echo "\x1b[33;1m === Nextcloud === \x1b[0m\n";
$nc_destination = "{$destPath}snappymail-{$package->version}-nextcloud.tar";
@unlink($nc_destination);
@unlink("{$nc_destination}.gz");
$nc_tar = new PharData($nc_destination);
$nc_tar->buildFromDirectory('./integrations/nextcloud', "@integrations/nextcloud/snappymail/@");
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('snappymail/v'), RecursiveIteratorIterator::SELF_FIRST);
foreach ($files as $file) {
if (is_file($file)) {
$file = str_replace('\\', '/', $file);
$nc_tar->addFile($file, "snappymail/app/{$file}");
}
}
/*
$nc_tar->addFile('data/.htaccess');
$nc_tar->addFromString('data/VERSION', $package->version);
$nc_tar->addFile('data/README.md');
*/
$nc_tar->addFile('_include.php', 'snappymail/app/_include.php');
$nc_tar->addFile('.htaccess', 'snappymail/app/.htaccess');
$index = file_get_contents('index.php');
$index = str_replace('0.0.0', $package->version, $index);
$nc_tar->addFromString('snappymail/app/index.php', $index);
$nc_tar->addFile('README.md', 'snappymail/app/README.md');
$data = file_get_contents('dev/serviceworker.js');
$nc_tar->addFromString('snappymail/app/serviceworker.js', $data);
$nc_tar->compress(Phar::GZ);
unlink($nc_destination);
$nc_destination .= '.gz';
echo "{$nc_destination} created\n";

View file

@ -1 +0,0 @@
2.18.5

View file

@ -3,10 +3,10 @@
<id>snappymail</id>
<name>SnappyMail</name>
<summary>SnappyMail Webmail</summary>
<description>Simple, modern and fast web-based email client. After enabling in Nextcloud, go to Nextcloud admin panel, "Additionnal settings" and you will see a "SnappyMail webmail" section. There, click on the link to go to the SnappyMail admin panel. The default user/password is admin/12345. This version is based on SnappyMail 2.6.0 (2021-07).</description>
<version>2.18.5</version>
<licence>agpl</licence>
<author>SnappyMail, RainLoop Team, Nextgen-Networks, Tab Fitts, Nathan Kinkade, Pierre-Alain Bandinelli</author>
<description>Simple, modern and fast web-based email client. After enabling in Nextcloud, go to Nextcloud admin panel, "Additionnal settings" and you will see a "SnappyMail webmail" section. There, click on the link to go to the SnappyMail admin panel.</description>
<namespace>SnappyMail</namespace>
<documentation>
<user>https://github.com/the-djmaze/snappymail/blob/master/integrations/nextcloud/snappymail/README.md</user>

View file

@ -1 +0,0 @@
7.1.2

View file

@ -2,7 +2,7 @@
<?php
chdir(__DIR__);
$options = getopt('', ['aur','docker','plugins','set-version','skip-gulp','debian','sign']);
$options = getopt('', ['aur','docker','plugins','set-version','skip-gulp','debian','nextcloud','sign']);
if (isset($options['plugins'])) {
require(__DIR__ . '/build/plugins.php');
@ -27,7 +27,6 @@ file_put_contents($file, preg_replace('/<upstream>[^<]*</', "<upstream>{$package
$file = __DIR__ . '/.docker/release/files/usr/local/include/application.ini';
file_put_contents($file, preg_replace('/current = "[0-9.]+"/', "current = \"{$package->version}\"", file_get_contents($file)));
// nextcloud
file_put_contents(__DIR__ . '/integrations/nextcloud/snappymail/VERSION', $package->version);
$file = __DIR__ . '/integrations/nextcloud/snappymail/appinfo/info.xml';
file_put_contents($file, preg_replace('/<version>[^<]*</', "<version>{$package->version}<", file_get_contents($file)));
// virtualmin
@ -175,6 +174,10 @@ $tar_destination .= '.gz';
echo "{$zip_destination} created\n{$tar_destination} created\n";
if (isset($options['nextcloud'])) {
require(__DIR__ . '/build/nextcloud.php');
}
rename("snappymail/v/{$package->version}", 'snappymail/v/0.0.0');
file_put_contents("{$destPath}core.json", '{
@ -252,6 +255,10 @@ if (isset($options['sign'])) {
echo "\x1b[33;1m === PGP Sign === \x1b[0m\n";
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '.escapeshellarg($tar_destination), $return_var);
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '.escapeshellarg($zip_destination), $return_var);
if (isset($options['nextcloud'])) {
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '
.escapeshellarg("{$destPath}snappymail-{$package->version}-nextcloud.tar.gz"), $return_var);
}
if (isset($options['debian'])) {
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '
. escapeshellarg(__DIR__ . "/build/dist/releases/webmail/{$package->version}/" . basename(DEB_DEST_DIR.'.deb')), $return_var);