Compare commits
No commits in common. "master" and "v1.6.1" have entirely different histories.
|
@ -1,28 +0,0 @@
|
||||||
name: Publish PHP Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Get tag name
|
|
||||||
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: zip and send
|
|
||||||
run: |
|
|
||||||
ls -la
|
|
||||||
apt-get update -y
|
|
||||||
apt-get install -y zip
|
|
||||||
cd ../
|
|
||||||
zip -r ${{ gitea.event.repository.name }}.zip ${{ gitea.event.repository.name }} -x '*.git*'
|
|
||||||
curl -v \
|
|
||||||
--user composer-pbl:${{ secrets.COMPOSER_PSWD }} \
|
|
||||||
--upload-file ${{ gitea.event.repository.name }}.zip \
|
|
||||||
https://git.bit5.ru/api/packages/bit/composer?version=${{ env.TAG }}
|
|
|
@ -1,5 +0,0 @@
|
||||||
## v1.8.1
|
|
||||||
- Adding null check in need_to_regen_any(..)
|
|
||||||
|
|
||||||
## v1.7.2
|
|
||||||
- Fixing weird lstat bug on Windows for rrmdir function for large amount of directory items
|
|
|
@ -87,6 +87,8 @@ function find_files(string $dir, array $fnmatch_patterns = []) : array
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//obsolete, use find_files instead
|
||||||
function scan_files_rec(array $dirs, array $only_extensions = [], int $mode = 1) : array
|
function scan_files_rec(array $dirs, array $only_extensions = [], int $mode = 1) : array
|
||||||
{
|
{
|
||||||
$files = array();
|
$files = array();
|
||||||
|
@ -166,7 +168,7 @@ function json_make_pretty(string $json) : string
|
||||||
return prettyJSON($json);
|
return prettyJSON($json);
|
||||||
}
|
}
|
||||||
|
|
||||||
function need_to_regen(string $file, iterable $deps, bool $debug = false) : bool
|
function need_to_regen(string $file, array $deps, bool $debug = false) : bool
|
||||||
{
|
{
|
||||||
if(!is_file($file))
|
if(!is_file($file))
|
||||||
{
|
{
|
||||||
|
@ -176,10 +178,9 @@ function need_to_regen(string $file, iterable $deps, bool $debug = false) : bool
|
||||||
}
|
}
|
||||||
|
|
||||||
$fmtime = filemtime($file);
|
$fmtime = filemtime($file);
|
||||||
|
|
||||||
foreach($deps as $dep)
|
foreach($deps as $dep)
|
||||||
{
|
{
|
||||||
if($dep && is_file($dep) && (filemtime($dep) > $fmtime))
|
if(is_file($dep) && (filemtime($dep) > $fmtime))
|
||||||
{
|
{
|
||||||
if($debug)
|
if($debug)
|
||||||
echo "$dep > $file\n";
|
echo "$dep > $file\n";
|
||||||
|
@ -214,9 +215,6 @@ function need_to_regen_any(array $files, array $deps, bool $debug = false) : boo
|
||||||
echo "need_to_regen_any, earliest file: $earliest_file ($date)\n";
|
echo "need_to_regen_any, earliest file: $earliest_file ($date)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($earliest_file === null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return need_to_regen($earliest_file, $deps, $debug);
|
return need_to_regen($earliest_file, $deps, $debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +587,7 @@ function rrmdir(string $dir, bool $remove_top_dir = true)
|
||||||
{
|
{
|
||||||
if($object != "." && $object != "..")
|
if($object != "." && $object != "..")
|
||||||
{
|
{
|
||||||
if(is_dir($dir."/".$object))
|
if(filetype($dir."/".$object) == "dir")
|
||||||
rrmdir($dir."/".$object);
|
rrmdir($dir."/".$object);
|
||||||
else
|
else
|
||||||
unlink($dir."/".$object);
|
unlink($dir."/".$object);
|
||||||
|
@ -606,66 +604,49 @@ function rrmdir(string $dir, bool $remove_top_dir = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define("GIT_INFO_REV_HASH" , 1 << 0);
|
function git_get_info() : array
|
||||||
define("GIT_INFO_BRANCH" , 1 << 1);
|
|
||||||
define("GIT_INFO_REV_NUMBER", 1 << 2);
|
|
||||||
define("GIT_INFO_ALL" , ~0);
|
|
||||||
|
|
||||||
function git_get_info($info = GIT_INFO_ALL) : array
|
|
||||||
{
|
{
|
||||||
global $GAME_ROOT;
|
global $GAME_ROOT;
|
||||||
$rev_hash = "";
|
|
||||||
$branch = "";
|
|
||||||
$revision_number = 0;
|
|
||||||
|
|
||||||
if(!is_dir("$GAME_ROOT/.git"))
|
if(!is_dir("$GAME_ROOT/.git"))
|
||||||
throw new Exception("Not a Git repository");
|
throw new Exception("Not a Git repository");
|
||||||
|
|
||||||
if($info & GIT_INFO_REV_HASH)
|
$out = array();
|
||||||
{
|
exec("git rev-parse HEAD", $out);
|
||||||
$out = array();
|
$rev_hash = trim($out[0]);
|
||||||
exec("git rev-parse HEAD", $out);
|
if(!$rev_hash)
|
||||||
$rev_hash = trim($out[0]);
|
throw new Exception("Error getting git revision hash");
|
||||||
if(!$rev_hash)
|
|
||||||
throw new Exception("Error getting git revision hash");
|
|
||||||
}
|
|
||||||
|
|
||||||
if($info & GIT_INFO_BRANCH)
|
$out = array();
|
||||||
{
|
exec("git rev-parse --abbrev-ref HEAD", $out);
|
||||||
$out = array();
|
$branch = trim($out[0]);
|
||||||
exec("git rev-parse --abbrev-ref HEAD", $out);
|
if(!$branch)
|
||||||
$branch = trim($out[0]);
|
throw new Exception("Error getting git branch");
|
||||||
if(!$branch)
|
|
||||||
throw new Exception("Error getting git branch");
|
|
||||||
}
|
|
||||||
|
|
||||||
if($info & GIT_INFO_REV_NUMBER)
|
$out = array();
|
||||||
{
|
exec("git rev-list HEAD --count", $out);
|
||||||
$out = array();
|
$revision_number = (int)$out[0];
|
||||||
exec("git rev-list HEAD --count", $out);
|
if(!$revision_number)
|
||||||
$revision_number = (int)$out[0];
|
throw new Exception("Error getting git revision number");
|
||||||
if(!$revision_number)
|
|
||||||
throw new Exception("Error getting git revision number");
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($rev_hash, $branch, $revision_number);
|
return array($rev_hash, $branch, $revision_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_get_rev_hash() : string
|
function git_get_rev_hash() : string
|
||||||
{
|
{
|
||||||
list($rev_hash, $_, $__) = git_get_info(GIT_INFO_REV_HASH);
|
list($rev_hash, $_, $__) = git_get_info();
|
||||||
return $rev_hash;
|
return $rev_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_get_branch() : string
|
function git_get_branch() : string
|
||||||
{
|
{
|
||||||
list($_, $branch, $__) = git_get_info(GIT_INFO_BRANCH);
|
list($_, $branch, $__) = git_get_info();
|
||||||
return $branch;
|
return $branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_get_rev_number() : string
|
function git_get_rev_number() : string
|
||||||
{
|
{
|
||||||
list($_, $__, $rev_number) = git_get_info(GIT_INFO_REV_NUMBER);
|
list($_, $__, $rev_number) = git_get_info();
|
||||||
return $rev_number;
|
return $rev_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1193,12 +1174,12 @@ function are_you_sure_ask() : bool
|
||||||
return $resp == "YES";
|
return $resp == "YES";
|
||||||
}
|
}
|
||||||
|
|
||||||
function names_hash_changed(string $crc_file, iterable $names) : bool
|
function names_hash_changed(string $crc_file, array $names) : bool
|
||||||
{
|
{
|
||||||
$ctx = hash_init('crc32');
|
$ctx = hash_init('crc32');
|
||||||
foreach($names as $name)
|
foreach($names as $name)
|
||||||
hash_update($ctx, $name);
|
hash_update($ctx, $name);
|
||||||
$names_crc = hash_final($ctx, false);
|
$names_crc = hash_final($ctx, true);
|
||||||
$changed = !file_exists($crc_file) || ensure_read($crc_file) != $names_crc;
|
$changed = !file_exists($crc_file) || ensure_read($crc_file) != $names_crc;
|
||||||
ensure_write($crc_file, $names_crc);
|
ensure_write($crc_file, $names_crc);
|
||||||
return $changed;
|
return $changed;
|
||||||
|
|
Loading…
Reference in New Issue