From a0dd373227a30ccad04a31c84d19666263f1519f Mon Sep 17 00:00:00 2001 From: Fu Cheng Date: Thu, 10 Oct 2024 17:15:24 +1300 Subject: [PATCH] package cli --- .github/workflows/publish.yaml | 34 +++++++++++++++++-- cli/pom.xml | 30 ++++++++++++++++ cli/src/assembly/cli.xml | 22 ++++++++++++ .../llmagentbuilder/cli/CliApplication.kt | 12 +++---- 4 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 cli/src/assembly/cli.xml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 38f3513..6223beb 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,7 +1,11 @@ -name: Publish package to the Maven Central Repository +name: Publish and Release +permissions: + contents: write + on: - release: - types: [ created ] + push: + tags: + - v[0-9]+.* jobs: publish: runs-on: ubuntu-latest @@ -23,3 +27,27 @@ jobs: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: cli + path: | + cli/target/cli-jar-with-dependencies.jar + retention-days: 1 + - uses: actions/download-artifact@v4 + with: + name: cli + + - name: Rename files + run: | + mkdir release-files + mv cli-jar-with-dependencies.jar release-files/llm-agent-builder-cli.jar + + - name: Create a Github Release + uses: ncipollo/release-action@v1 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + body: ${{ github.ref_name }} + artifacts: "release-files/*" + generateReleaseNotes: true diff --git a/cli/pom.xml b/cli/pom.xml index e219e42..e371428 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -74,4 +74,34 @@ 1.9.22 + + + + + maven-assembly-plugin + 3.7.1 + + cli + + src/assembly/cli.xml + + + + io.github.llmagentbuilder.cli.CliApplicationKt + + + + + + + make-assembly + package + + single + + + + + + \ No newline at end of file diff --git a/cli/src/assembly/cli.xml b/cli/src/assembly/cli.xml new file mode 100644 index 0000000..4d80363 --- /dev/null +++ b/cli/src/assembly/cli.xml @@ -0,0 +1,22 @@ + + jar-with-dependencies + + jar + + false + + + / + true + true + runtime + + + + + metaInf-services + + + \ No newline at end of file diff --git a/cli/src/main/kotlin/io/github/llmagentbuilder/cli/CliApplication.kt b/cli/src/main/kotlin/io/github/llmagentbuilder/cli/CliApplication.kt index 1e30719..acca680 100644 --- a/cli/src/main/kotlin/io/github/llmagentbuilder/cli/CliApplication.kt +++ b/cli/src/main/kotlin/io/github/llmagentbuilder/cli/CliApplication.kt @@ -4,26 +4,22 @@ import io.github.llmagentbuilder.cli.command.BuildCommand import io.github.llmagentbuilder.cli.command.RunCommand import picocli.CommandLine import java.io.File -import java.util.concurrent.Callable import kotlin.system.exitProcess @CommandLine.Command( name = "llm-agent-builder", mixinStandardHelpOptions = true, - version = ["0.2.0"], + version = ["0.3.0"], description = ["Build LLM agents"], subcommands = [RunCommand::class, BuildCommand::class], ) -class CliApplication : Callable { +class CliApplication { @CommandLine.Option( names = ["-c", "--config"], - description = ["agent config file"] + description = ["agent config file"], + required = true, ) lateinit var configFile: File - - override fun call(): Void? { - return null - } } fun main(args: Array): Unit =