Docker-compose file, logo update and formatting
This commit is contained in:
parent
7314cde1f4
commit
d874f4bd5f
3 changed files with 42 additions and 24 deletions
|
@ -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()
|
||||
}
|
||||
|
|
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal 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
|
Loading…
Reference in a new issue