diff --git a/AGENTS.md b/AGENTS.md index f70f0ea..6b18b6a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,8 +16,8 @@ Detailed guides live as Agent Skills under `.claude/skills/` ([SKILL.md format]( Run the JAR directly: ```bash -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar --help -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar init +java -jar build/libs/gittally.jar --help +java -jar build/libs/gittally.jar init ``` `ktlintFormat` must be run before `build` passes — the formatter is enforced as part of the `check` lifecycle. diff --git a/build.gradle.kts b/build.gradle.kts index c2aa1e8..4973998 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "de.hoennig" -version = "0.1.0-SNAPSHOT" +version = "0.9.0" java { toolchain { @@ -63,6 +63,12 @@ springBoot { } } +tasks.bootJar { + // version-free jar name, so docs and scripts never contain the version; + // the version itself stays available via BuildProperties (UI footer, --version) + archiveFileName = "gittally.jar" +} + kotlin { compilerOptions { freeCompilerArgs.addAll("-Xjsr305=strict") diff --git a/docs/GitTally-Konzept.md b/docs/GitTally-Konzept.md index a083e57..29dbbd5 100644 --- a/docs/GitTally-Konzept.md +++ b/docs/GitTally-Konzept.md @@ -161,13 +161,13 @@ Ob ein neuer Commit den laufenden Build seines Branches stattdessen abbrechen so ### Initialisierung ```bash -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar init +java -jar build/libs/gittally.jar init ``` ### Serverstart ```bash -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar server +java -jar build/libs/gittally.jar server ``` Für den Dauerbetrieb als systemd-User-Service siehe [deployment.md](deployment.md) (`init --systemd`). @@ -175,8 +175,8 @@ Für den Dauerbetrieb als systemd-User-Service siehe [deployment.md](deployment. ### Konfigurationsanzeige ```bash -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar config:print -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar config:print --full +java -jar build/libs/gittally.jar config:print +java -jar build/libs/gittally.jar config:print --full ``` ## Erweiterungen diff --git a/docs/bootstrapping.md b/docs/bootstrapping.md index 75a3725..8deb8e8 100644 --- a/docs/bootstrapping.md +++ b/docs/bootstrapping.md @@ -23,7 +23,7 @@ First, in ``, build the application to generate the executable JA Then run `init` using the generated JAR (not the `-plain.jar`): ```bash -java -jar /build/libs/gittally-0.1.0-SNAPSHOT.jar init +java -jar /build/libs/gittally.jar init ``` `init` performs the following steps in order: @@ -120,11 +120,11 @@ Until then, a Java runtime must be available on the host. 2. Review `.gittally.yml` and add/adjust any branch build settings. 3. Verify the effective configuration: ```bash - java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar config:print --full + java -jar build/libs/gittally.jar config:print --full ``` 4. Start the server: ```bash - java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar server + java -jar build/libs/gittally.jar server ``` 5. For permanent operation, install the systemd user service described in [deployment.md](deployment.md). diff --git a/docs/configuration.md b/docs/configuration.md index 7a2dfc0..16c990a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -14,8 +14,8 @@ The repo install config (`.git/gittally/.gittally.yml`) wins on any key present ## Inspect the Effective Config ```bash -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar config:print # only explicitly set values -java -jar build/libs/gittally-0.1.0-SNAPSHOT.jar config:print --full # all values including defaults +java -jar build/libs/gittally.jar config:print # only explicitly set values +java -jar build/libs/gittally.jar config:print --full # all values including defaults ``` ## `.gittally.yml` diff --git a/docs/deployment.md b/docs/deployment.md index a32331c..d5ad3b1 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -19,14 +19,14 @@ Build the executable jar once: ```bash ./gradlew build -ls build/libs/gittally-*-SNAPSHOT.jar +ls build/libs/gittally.jar ``` Copy the jar to a stable path outside any watched repository, by convention `~/bin/gittally.jar`: ```bash mkdir -p ~/bin -cp build/libs/gittally-0.1.0-SNAPSHOT.jar ~/bin/gittally.jar +cp build/libs/gittally.jar ~/bin/gittally.jar ``` The systemd unit generated below points at the jar that was used to run `init --systemd`. diff --git a/docs/examples/setup-gittally-selfhost.sh b/docs/examples/setup-gittally-selfhost.sh index 249e973..cdffaa0 100755 --- a/docs/examples/setup-gittally-selfhost.sh +++ b/docs/examples/setup-gittally-selfhost.sh @@ -21,8 +21,7 @@ ORIGIN_URL="${ORIGIN_URL:-$(git -C "$DEV_CHECKOUT" remote get-url origin)}" # 2. Dedicated clone: builds run in worktrees under its .git/gittally/worktrees, # completely separate from your dev checkout. mkdir -p "$INSTALL_DIR" -JAR=$(ls "$DEV_CHECKOUT"/build/libs/gittally-*.jar | grep -v -- '-plain' | head -1) -cp "$JAR" "$INSTALL_DIR/gittally.jar" +cp "$DEV_CHECKOUT/build/libs/gittally.jar" "$INSTALL_DIR/gittally.jar" if [ ! -d "$INSTALL_DIR/repo/.git" ]; then git clone "$ORIGIN_URL" "$INSTALL_DIR/repo" fi diff --git a/docs/examples/setup-gittally-testserver.sh b/docs/examples/setup-gittally-testserver.sh index 8e0b6ed..85698dd 100755 --- a/docs/examples/setup-gittally-testserver.sh +++ b/docs/examples/setup-gittally-testserver.sh @@ -24,8 +24,7 @@ DEV_CHECKOUT=$(git rev-parse --show-toplevel) # 1. Build the GitTally jar. (cd "$DEV_CHECKOUT" && ./gradlew --console=plain build) mkdir -p "$INSTALL_DIR" -JAR=$(ls "$DEV_CHECKOUT"/build/libs/gittally-*.jar | grep -v -- '-plain' | head -1) -cp "$JAR" "$INSTALL_DIR/gittally.jar" +cp "$DEV_CHECKOUT/build/libs/gittally.jar" "$INSTALL_DIR/gittally.jar" # 2. Scratch bare origin plus a "work" clone for triggering builds by pushing. if [ ! -d "$INSTALL_DIR/origin.git" ]; then diff --git a/src/main/kotlin/de/hoennig/gittally/GitTallyCommand.kt b/src/main/kotlin/de/hoennig/gittally/GitTallyCommand.kt index 56537a1..5ab27fc 100644 --- a/src/main/kotlin/de/hoennig/gittally/GitTallyCommand.kt +++ b/src/main/kotlin/de/hoennig/gittally/GitTallyCommand.kt @@ -6,6 +6,8 @@ import de.hoennig.gittally.commands.InitCommand import de.hoennig.gittally.commands.RetryCommand import de.hoennig.gittally.commands.ServerCommand import de.hoennig.gittally.commands.StatusCommand +import org.springframework.beans.factory.ObjectProvider +import org.springframework.boot.info.BuildProperties import org.springframework.stereotype.Component import picocli.CommandLine import picocli.CommandLine.Command @@ -22,8 +24,22 @@ import picocli.CommandLine.Command ConfigPrintCommand::class, ], mixinStandardHelpOptions = true, + versionProvider = BuildPropertiesVersionProvider::class, description = ["Lightweight, declarative CI/CD system"], ) class GitTallyCommand : Runnable { override fun run(): Unit = throw CommandLine.ParameterException(CommandLine(this), "Specify a subcommand") } + +/** + * Feeds `--version` from the Gradle project version via the `build-info` + * [BuildProperties] — the same source as the web UI footer, so the version is + * declared only in `build.gradle.kts`. Resolved through picocli's Spring factory; + * `dev` when running from classes (IDE, tests) where no build info exists. + */ +@Component +class BuildPropertiesVersionProvider( + private val buildProperties: ObjectProvider, +) : CommandLine.IVersionProvider { + override fun getVersion(): Array = arrayOf("GitTally v${buildProperties.getIfAvailable()?.version ?: "dev"}") +}