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,19 +3,22 @@ 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 =
System.getenv("LOG_LEVEL")
?.let { LogLevel.valueOf(it.uppercase()) } ?.let { LogLevel.valueOf(it.uppercase()) }
?: LogLevel.valueOf("INFO") ?: LogLevel.valueOf("INFO")
if (activeLogLevel.order <= this.order) { if (activeLogLevel.order <= this.order) {
@ -23,7 +26,8 @@ enum class LogLevel(val order: Int, val out: PrintStream) {
} }
} }
private val timeFormatter = java.time.format.DateTimeFormatterBuilder() private val timeFormatter =
java.time.format.DateTimeFormatterBuilder()
.appendValue(java.time.temporal.ChronoField.HOUR_OF_DAY, 2) .appendValue(java.time.temporal.ChronoField.HOUR_OF_DAY, 2)
.appendLiteral(':') .appendLiteral(':')
.appendValue(java.time.temporal.ChronoField.MINUTE_OF_HOUR, 2) .appendValue(java.time.temporal.ChronoField.MINUTE_OF_HOUR, 2)
@ -34,10 +38,11 @@ enum class LogLevel(val order: Int, val out: PrintStream) {
.appendValue(java.time.temporal.ChronoField.MILLI_OF_SECOND, 3) .appendValue(java.time.temporal.ChronoField.MILLI_OF_SECOND, 3)
.toFormatter() .toFormatter()
private val dateTimeFormatter = java.time.format.DateTimeFormatterBuilder() private val dateTimeFormatter =
java.time.format.DateTimeFormatterBuilder()
.parseCaseInsensitive() .parseCaseInsensitive()
.append(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE) .append(java.time.format.DateTimeFormatter.ISO_LOCAL_DATE)
.appendLiteral('T') .appendLiteral('T')
.append(timeFormatter) .append(timeFormatter)
.toFormatter(); .toFormatter()
} }

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