From d874f4bd5ffc53c5ab1348acf6b354ba82164b70 Mon Sep 17 00:00:00 2001 From: Ryan Harg Date: Sat, 17 Feb 2024 20:51:08 +0100 Subject: [PATCH] Docker-compose file, logo update and formatting --- .../kotlin/de/rpr/githubreleases/LogLevel.kt | 51 ++++++++++--------- app/src/main/resources/logo.txt | 2 +- docker-compose.yml | 13 +++++ 3 files changed, 42 insertions(+), 24 deletions(-) create mode 100644 docker-compose.yml diff --git a/app/src/main/kotlin/de/rpr/githubreleases/LogLevel.kt b/app/src/main/kotlin/de/rpr/githubreleases/LogLevel.kt index 1a13f2c..deed8bc 100644 --- a/app/src/main/kotlin/de/rpr/githubreleases/LogLevel.kt +++ b/app/src/main/kotlin/de/rpr/githubreleases/LogLevel.kt @@ -3,41 +3,46 @@ package de.rpr.githubreleases import java.io.PrintStream import java.time.LocalDateTime -fun log(message: String, logLevel: LogLevel = LogLevel.INFO) { +fun log( + message: String, + logLevel: LogLevel = LogLevel.INFO, +) { logLevel.log(message) } enum class LogLevel(val order: Int, val out: PrintStream) { DEBUG(1, System.out), INFO(2, System.out), - ERROR(3, System.err); - - + ERROR(3, System.err), + ; fun log(message: String) { - val activeLogLevel = System.getenv("LOG_LEVEL") - ?.let { LogLevel.valueOf(it.uppercase()) } - ?: LogLevel.valueOf("INFO") + val activeLogLevel = + System.getenv("LOG_LEVEL") + ?.let { LogLevel.valueOf(it.uppercase()) } + ?: LogLevel.valueOf("INFO") if (activeLogLevel.order <= this.order) { out.println("${LocalDateTime.now().format(dateTimeFormatter)} $this - $message") } } - private val timeFormatter = java.time.format.DateTimeFormatterBuilder() - .appendValue(java.time.temporal.ChronoField.HOUR_OF_DAY, 2) - .appendLiteral(':') - .appendValue(java.time.temporal.ChronoField.MINUTE_OF_HOUR, 2) - .optionalStart() - .appendLiteral(':') - .appendValue(java.time.temporal.ChronoField.SECOND_OF_MINUTE, 2) - .appendLiteral(".") - .appendValue(java.time.temporal.ChronoField.MILLI_OF_SECOND, 3) - .toFormatter() + private val timeFormatter = + java.time.format.DateTimeFormatterBuilder() + .appendValue(java.time.temporal.ChronoField.HOUR_OF_DAY, 2) + .appendLiteral(':') + .appendValue(java.time.temporal.ChronoField.MINUTE_OF_HOUR, 2) + .optionalStart() + .appendLiteral(':') + .appendValue(java.time.temporal.ChronoField.SECOND_OF_MINUTE, 2) + .appendLiteral(".") + .appendValue(java.time.temporal.ChronoField.MILLI_OF_SECOND, 3) + .toFormatter() - private val dateTimeFormatter = java.time.format.DateTimeFormatterBuilder() - .parseCaseInsensitive() - .append(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE) - .appendLiteral('T') - .append(timeFormatter) - .toFormatter(); + private val dateTimeFormatter = + java.time.format.DateTimeFormatterBuilder() + .parseCaseInsensitive() + .append(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE) + .appendLiteral('T') + .append(timeFormatter) + .toFormatter() } diff --git a/app/src/main/resources/logo.txt b/app/src/main/resources/logo.txt index 259590e..c90ab3f 100644 --- a/app/src/main/resources/logo.txt +++ b/app/src/main/resources/logo.txt @@ -2,4 +2,4 @@ ___ <_> _| |_ | |_ _ _ | |_ ___ _ _ ___ | | ___ ___ ___ ___ ___ | |_ ___ _| |_ / . || | | | | . || | || . \|___|| '_>/ ._>| |/ ._><_> |<_-|___|| . \/ . \ | | \_. ||_| |_| |_|_|`___||___/ |_| \___.|_|\___.<___|/__/\___. |___/\___/ |_| -<___' \ No newline at end of file +<___' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e07db22 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.1' +services: + github-release-bot: + image: github-release-bot:latest + restart: unless-stopped + environment: + SCHEDULING_DELAY: ${SCHEDULING_DELAY} + REPO_PATH: /releases + PUBLISH_DRY_RUN: ${PUBLISH_DRY_RUN} + LOG_LEVEL: ${LOG_LEVEL} + volumes: + - ./releases:/releases + - ./config.json:/config.json \ No newline at end of file