deploy: fix
This commit is contained in:
parent
15e8f55ea4
commit
a2ec3c1087
@ -25,5 +25,8 @@ done
|
|||||||
for project in ic foreignone; do
|
for project in ic foreignone; do
|
||||||
"$SCRIPT_DIR"/util/build_css.sh -i "$APP_DIR/public/$project/scss" -o "$OUTPUT_ROOT_DIR/public/$project/dist-css" || die "build_css failed"
|
"$SCRIPT_DIR"/util/build_css.sh -i "$APP_DIR/public/$project/scss" -o "$OUTPUT_ROOT_DIR/public/$project/dist-css" || die "build_css failed"
|
||||||
"$SCRIPT_DIR"/util/build_js.sh -i "$APP_DIR/public/common/js" -o "$OUTPUT_ROOT_DIR/public/$project/dist-js" || die "build_js failed"
|
"$SCRIPT_DIR"/util/build_js.sh -i "$APP_DIR/public/common/js" -o "$OUTPUT_ROOT_DIR/public/$project/dist-js" || die "build_js failed"
|
||||||
$PHP "$SCRIPT_DIR"/util/gen_runtime_config.php --commit-hash "$(git rev-parse --short=8 HEAD)" > "$OUTPUT_ROOT_DIR/config-runtime.php" || die "gen_runtime_config failed"
|
$PHP "$SCRIPT_DIR"/util/gen_runtime_config.php \
|
||||||
|
--app-root "$OUTPUT_ROOT_DIR" \
|
||||||
|
--commit-hash "$(git rev-parse --short=8 HEAD)" \
|
||||||
|
> "$OUTPUT_ROOT_DIR/config-runtime.php" || die "gen_runtime_config failed"
|
||||||
done
|
done
|
||||||
|
@ -4,18 +4,23 @@
|
|||||||
require __DIR__.'/../../src/init.php';
|
require __DIR__.'/../../src/init.php';
|
||||||
|
|
||||||
$commit_hash = null;
|
$commit_hash = null;
|
||||||
|
$app_root = null;
|
||||||
for ($i = 1; $i < $argc; $i++) {
|
for ($i = 1; $i < $argc; $i++) {
|
||||||
switch ($argv[$i]) {
|
switch ($argv[$i]) {
|
||||||
case '--commit-hash':
|
case '--commit-hash':
|
||||||
$commit_hash = $argv[++$i] ?? usage('missing value for --commit-hash');
|
$commit_hash = $argv[++$i] ?? usage('missing value for --commit-hash');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '--app-root':
|
||||||
|
$app_root = $argv[++$i] ?? usage('missing value for --app-root');
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
usage("unknown option {$argv[$i]}");
|
usage("unknown option {$argv[$i]}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($commit_hash))
|
if (is_null($commit_hash) || is_null($app_root))
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
$hashes = [
|
$hashes = [
|
||||||
@ -25,7 +30,7 @@ $hashes = [
|
|||||||
|
|
||||||
foreach (['ic', 'foreignone'] as $project) {
|
foreach (['ic', 'foreignone'] as $project) {
|
||||||
foreach (['js', 'css'] as $type) {
|
foreach (['js', 'css'] as $type) {
|
||||||
$dist_dir = APP_ROOT.'/public/'.$project.'/dist-'.$type;
|
$dist_dir = $app_root.'/public/'.$project.'/dist-'.$type;
|
||||||
$entries = glob_recursive($dist_dir.'/*.'.$type);
|
$entries = glob_recursive($dist_dir.'/*.'.$type);
|
||||||
if (empty($entries)) {
|
if (empty($entries)) {
|
||||||
fwrite(STDERR, "warning: no files found in $dist_dir\n");
|
fwrite(STDERR, "warning: no files found in $dist_dir\n");
|
||||||
@ -49,7 +54,7 @@ function usage(string $msg = ''): never {
|
|||||||
if ($msg !== '')
|
if ($msg !== '')
|
||||||
fwrite(STDERR, "error: {$msg}\n");
|
fwrite(STDERR, "error: {$msg}\n");
|
||||||
$script = $GLOBALS['argv'][0];
|
$script = $GLOBALS['argv'][0];
|
||||||
fwrite(STDERR, "usage: {$script} --commit-hash HASH\n");
|
fwrite(STDERR, "usage: {$script} --commit-hash HASH --app-root APP_ROOT\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user