Skip to content

Commit

Permalink
[ci] more specific version in /system_info, less specific version in …
Browse files Browse the repository at this point in the history
…footer
  • Loading branch information
shish committed Jan 6, 2024
1 parent 4df1e93 commit e57264f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
id: get_version
run: echo VERSION=${GITHUB_REF/refs\/tags\/v/} >> $GITHUB_OUTPUT

- name: Test version in sys_config
run: grep ${{ steps.get_version.outputs.VERSION }} core/sys_config.php
- name: Check and set sys_config
run: |
grep ${{ steps.get_version.outputs.VERSION }} core/sys_config.php
echo "_d('BUILD_TIME', '$(date +'%Y-%m-%dT%H:%M:%S')');" >> core/sys_config.php
echo "_d('BUILD_HASH', '$GITHUB_SHA');" >> core/sys_config.php
- name: Build
run: |
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ FROM base AS run
EXPOSE 8000
# HEALTHCHECK --interval=1m --timeout=3s CMD curl --fail http://127.0.0.1:8000/ || exit 1
ARG BUILD_TIME=unknown BUILD_HASH=unknown
ENV UID=1000 GID=1000 UPLOAD_MAX_FILESIZE=50M BUILD_TIME=${BUILD_TIME} BUILD_HASH=${BUILD_HASH}
ENV UID=1000 GID=1000 UPLOAD_MAX_FILESIZE=50M
COPY --from=build /app /app
WORKDIR /app
RUN echo "_d('BUILD_TIME', '$BUILD_TIME');" >> core/sys_config.php && \
echo "_d('BUILD_HASH', '$BUILD_HASH');" >> core/sys_config.php
ENTRYPOINT ["/app/.docker/entrypoint.sh"]
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
4 changes: 2 additions & 2 deletions core/sys_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ function _d(string $name, $value): void
define($name, $value);
}
}
$_g = file_exists(".git") ? '+' : '';

_d("DATABASE_DSN", null); // string PDO database connection details
_d("DATABASE_TIMEOUT", 10000); // int Time to wait for each statement to complete
_d("CACHE_DSN", null); // string cache connection details
_d("DEBUG", false); // boolean print various debugging details
_d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes
_d("SPEED_HAX", false); // boolean do some questionable things in the name of performance
_d("WH_SPLITS", 1); // int how many levels of subfolders to put in the warehouse
_d("VERSION", "2.10.0-beta$_g"); // string shimmie version
_d("VERSION", "2.10.0-beta2"); // string shimmie version
_d("TIMEZONE", null); // string timezone
_d("EXTRA_EXTS", ""); // string optional extra extensions
_d("BASE_HREF", null); // string force a specific base URL (default is auto-detect)
Expand Down
13 changes: 12 additions & 1 deletion ext/et/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,25 @@ private function get_info(): array
}
}

$ver = VERSION;
if(defined("BUILD_TIME")) {
$ver .= "-" . substr(constant("BUILD_TIME"), 0, 10);
}
if(defined("BUILD_HASH")) {
$ver .= "-" . substr(constant("BUILD_HASH"), 0, 7);
}
if(file_exists(".git")) {
$ver .= "+";
}

$info = [
"about" => [
'title' => $config->get_string(SetupConfig::TITLE),
'theme' => $config->get_string(SetupConfig::THEME),
'url' => make_http(make_link("/")),
],
"versions" => [
'shimmie' => VERSION,
'shimmie' => $ver,
'schema' => $config->get_int("db_version"),
'php' => phpversion(),
'db' => $database->get_driver_id()->value . " " . $database->get_version(),
Expand Down

0 comments on commit e57264f

Please sign in to comment.