GitHub Actions

Build self-contained JVM binaries in your CI/CD pipeline.

Quick Start

name: Build Binary

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 21

      - uses: avelino/jbundle@main
        with:
          input: .
          output: ./dist/myapp

      - uses: actions/upload-artifact@v4
        with:
          name: myapp-linux-x64
          path: ./dist/myapp

That's it. Replace myapp with your app name.

Action Reference

Inputs

Input
Required
Default
Description

version

no

latest

jbundle version to install (e.g., v0.2.0)

input

no

Path to project directory or JAR file

output

no

Output binary path

java-version

no

JDK version to bundle (11, 17, 21, etc.)

target

no

Target platform (linux-x64, macos-aarch64, etc.)

profile

no

JVM profile (cli or server)

shrink

no

Shrink uberjar (true to enable)

args

no

Additional arguments passed to jbundle build

install-only

no

false

Only install jbundle, don't run build

Outputs

Output
Description

binary

Path to the output binary

version

Installed jbundle version

Examples

CLI Tool with Fast Startup

Specific Java Version

From Pre-built JAR

Install Only (Custom Build Commands)

Extra Arguments

Pin to a Specific Version

Cross-Platform Builds

Build for multiple platforms using a matrix:

Windows CI

jbundle works on windows-latest runners. Build binaries for all platforms from Windows:

Note: The output binary uses a Unix shell stub, so --target must be a Linux or macOS platform. Windows is supported as a build host, not an output target.

Gradle Multi-Project

For projects with multiple subprojects (like JabRef):

Or with a pre-built jlink runtime:

Caching

Speed up builds by caching the jbundle JDK cache:

Reusing the CI JDK

setup-java sets JAVA_HOME automatically. jbundle detects it and skips the Adoptium download:

Using jbundle.toml

Instead of passing inputs, use a config file in your repo:

Then your workflow simplifies to:

Release Workflow

Create releases with binaries for all platforms:

Debug

Enable verbose logging:

Or use dry-run to preview the build plan:

Troubleshooting

Build hangs at "Detecting build system"

Gradle downloading dependencies. Add caching:

Out of memory

Last updated

Was this helpful?