Docker-compose file, logo update and formatting

This commit is contained in:
Ryan Harg 2024-02-17 20:51:08 +01:00
parent 7314cde1f4
commit d874f4bd5f
3 changed files with 42 additions and 24 deletions

View file

@ -3,41 +3,46 @@ package de.rpr.githubreleases
import java.io.PrintStream import java.io.PrintStream
import java.time.LocalDateTime import java.time.LocalDateTime
fun log(message: String, logLevel: LogLevel = LogLevel.INFO) { fun log(
message: String,
logLevel: LogLevel = LogLevel.INFO,
) {
logLevel.log(message) logLevel.log(message)
} }
enum class LogLevel(val order: Int, val out: PrintStream) { enum class LogLevel(val order: Int, val out: PrintStream) {
DEBUG(1, System.out), DEBUG(1, System.out),
INFO(2, System.out), INFO(2, System.out),
ERROR(3, System.err); ERROR(3, System.err),
;
fun log(message: String) { fun log(message: String) {
val activeLogLevel = System.getenv("LOG_LEVEL") val activeLogLevel =
?.let { LogLevel.valueOf(it.uppercase()) } System.getenv("LOG_LEVEL")
?: LogLevel.valueOf("INFO") ?.let { LogLevel.valueOf(it.uppercase()) }
?: LogLevel.valueOf("INFO")
if (activeLogLevel.order <= this.order) { if (activeLogLevel.order <= this.order) {
out.println("${LocalDateTime.now().format(dateTimeFormatter)} $this - $message") out.println("${LocalDateTime.now().format(dateTimeFormatter)} $this - $message")
} }
} }
private val timeFormatter = java.time.format.DateTimeFormatterBuilder() private val timeFormatter =
.appendValue(java.time.temporal.ChronoField.HOUR_OF_DAY, 2) java.time.format.DateTimeFormatterBuilder()
.appendLiteral(':') .appendValue(java.time.temporal.ChronoField.HOUR_OF_DAY, 2)
.appendValue(java.time.temporal.ChronoField.MINUTE_OF_HOUR, 2) .appendLiteral(':')
.optionalStart() .appendValue(java.time.temporal.ChronoField.MINUTE_OF_HOUR, 2)
.appendLiteral(':') .optionalStart()
.appendValue(java.time.temporal.ChronoField.SECOND_OF_MINUTE, 2) .appendLiteral(':')
.appendLiteral(".") .appendValue(java.time.temporal.ChronoField.SECOND_OF_MINUTE, 2)
.appendValue(java.time.temporal.ChronoField.MILLI_OF_SECOND, 3) .appendLiteral(".")
.toFormatter() .appendValue(java.time.temporal.ChronoField.MILLI_OF_SECOND, 3)
.toFormatter()
private val dateTimeFormatter = java.time.format.DateTimeFormatterBuilder() private val dateTimeFormatter =
.parseCaseInsensitive() java.time.format.DateTimeFormatterBuilder()
.append(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE) .parseCaseInsensitive()
.appendLiteral('T') .append(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE)
.append(timeFormatter) .appendLiteral('T')
.toFormatter(); .append(timeFormatter)
.toFormatter()
} }

View file

@ -2,4 +2,4 @@
___ <_> _| |_ | |_ _ _ | |_ ___ _ _ ___ | | ___ ___ ___ ___ ___ | |_ ___ _| |_ ___ <_> _| |_ | |_ _ _ | |_ ___ _ _ ___ | | ___ ___ ___ ___ ___ | |_ ___ _| |_
/ . || | | | | . || | || . \|___|| '_>/ ._>| |/ ._><_> |<_-</ ._>|___|| . \/ . \ | | / . || | | | | . || | || . \|___|| '_>/ ._>| |/ ._><_> |<_-</ ._>|___|| . \/ . \ | |
\_. ||_| |_| |_|_|`___||___/ |_| \___.|_|\___.<___|/__/\___. |___/\___/ |_| \_. ||_| |_| |_|_|`___||___/ |_| \___.|_|\___.<___|/__/\___. |___/\___/ |_|
<___' <___'

13
docker-compose.yml Normal file
View file

@ -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