Skip to content

Commit 41d141c

Browse files
committed
First draft of jRelease integration to create distibutions of the binary artifacts.
1 parent e57e2d0 commit 41d141c

8 files changed

Lines changed: 485 additions & 14 deletions

File tree

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Binary Release
2+
3+
# Trigger AFTER the Maven release has created a tag and GitHub release
4+
# This workflow adds native binaries to the existing release
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version tag to attach binaries to (e.g., 0.34.0)'
10+
required: true
11+
type: string
12+
dry_run:
13+
description: 'Dry run: build binaries but skip release/publishing'
14+
required: false
15+
type: boolean
16+
default: false
17+
push:
18+
tags:
19+
- '[0-9]+.[0-9]+.[0-9]+'
20+
21+
env:
22+
GRAAL_VERSION: '25'
23+
JAVA_VERSION: '25'
24+
25+
jobs:
26+
# Build native binaries for each platform
27+
build:
28+
name: Build ${{ matrix.platform }}-${{ matrix.arch }}
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
# macOS Intel
34+
- os: macos-13
35+
platform: darwin
36+
arch: x86_64
37+
artifact-suffix: darwin-x86_64
38+
39+
# macOS Apple Silicon
40+
- os: macos-latest
41+
platform: darwin
42+
arch: aarch64
43+
artifact-suffix: darwin-aarch64
44+
45+
# Linux x86_64
46+
- os: ubuntu-latest
47+
platform: linux
48+
arch: x86_64
49+
artifact-suffix: linux-x86_64
50+
51+
# Linux ARM64 (via Docker)
52+
- os: ubuntu-latest
53+
platform: linux
54+
arch: aarch64
55+
artifact-suffix: linux-aarch64
56+
use-docker: true
57+
58+
# Windows x86_64
59+
- os: windows-latest
60+
platform: windows
61+
arch: x86_64
62+
artifact-suffix: windows-x86_64
63+
64+
runs-on: ${{ matrix.os }}
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
72+
- name: Set up GraalVM
73+
if: ${{ !matrix.use-docker }}
74+
uses: graalvm/setup-graalvm@v1
75+
with:
76+
java-version: ${{ env.JAVA_VERSION }}
77+
distribution: 'graalvm'
78+
github-token: ${{ secrets.GITHUB_TOKEN }}
79+
native-image-job-reports: 'true'
80+
81+
- name: Build Native Binary (Linux ARM64 via Docker)
82+
if: matrix.use-docker && matrix.arch == 'aarch64'
83+
run: |
84+
docker run --rm \
85+
-v "${{ github.workspace }}:/workspace" \
86+
-w /workspace/jmolecules-cli \
87+
--platform linux/arm64 \
88+
ghcr.io/graalvm/graalvm-community:25 \
89+
sh -c "../mvnw -B -Pdist clean package"
90+
91+
- name: Build Native Binary (Standard)
92+
if: ${{ !matrix.use-docker }}
93+
working-directory: jmolecules-cli
94+
run: ../mvnw -B -Pdist clean package
95+
96+
- name: Create Archive (Unix)
97+
if: matrix.platform != 'windows'
98+
working-directory: jmolecules-cli/target
99+
run: |
100+
mkdir -p distributions
101+
tar -czf distributions/jm-${{ github.event.inputs.version || github.ref_name }}-${{ matrix.artifact-suffix }}.tar.gz \
102+
-C .. target/jm \
103+
-C .. target/jm.completion
104+
105+
- name: Create Archive (Windows)
106+
if: matrix.platform == 'windows'
107+
working-directory: jmolecules-cli/target
108+
shell: pwsh
109+
run: |
110+
New-Item -ItemType Directory -Force -Path distributions
111+
Compress-Archive -Path jm.exe,jm.completion -DestinationPath distributions/jm-${{ github.event.inputs.version || github.ref_name }}-${{ matrix.artifact-suffix }}.zip
112+
113+
- name: Upload Artifact
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: jm-${{ matrix.artifact-suffix }}
117+
path: jmolecules-cli/target/distributions/*
118+
retention-days: ${{ github.event.inputs.dry_run == 'true' && 7 || 1 }}
119+
120+
# Attach binaries to existing release using jReleaser
121+
release:
122+
name: Attach Binaries to Release
123+
needs: [build]
124+
if: ${{ github.event.inputs.dry_run != 'true' }}
125+
runs-on: ubuntu-latest
126+
127+
steps:
128+
- name: Checkout
129+
uses: actions/checkout@v4
130+
with:
131+
fetch-depth: 0
132+
133+
- name: Download all artifacts
134+
uses: actions/download-artifact@v4
135+
with:
136+
path: jmolecules-cli/target/distributions
137+
merge-multiple: true
138+
139+
- name: Set up Java
140+
uses: actions/setup-java@v4
141+
with:
142+
java-version: ${{ env.JAVA_VERSION }}
143+
distribution: 'temurin'
144+
145+
- name: Run JReleaser (Update Release)
146+
uses: jreleaser/release-action@v2
147+
with:
148+
version: latest
149+
arguments: full-release
150+
working-directory: jmolecules-cli
151+
env:
152+
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version || github.ref_name }}
153+
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
154+
155+
- name: JReleaser Output
156+
if: always()
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: jreleaser-logs
160+
path: |
161+
jmolecules-cli/out/jreleaser/trace.log
162+
jmolecules-cli/out/jreleaser/output.properties

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ target/
1212
*.iws
1313
.flattened-pom.xml
1414
changelog.txt
15+
.jreleaser/

jmolecules-cli/README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# jMolecules CLI (`jm`)
2+
3+
Command-line interface for jMolecules - Domain-Driven Design and architecture building blocks for Java projects.
4+
5+
## Installation
6+
7+
### macOS
8+
9+
#### Homebrew
10+
11+
```bash
12+
brew install xmolecules/jm
13+
```
14+
15+
Bash completion is installed automatically and works in both bash and zsh.
16+
17+
### Linux
18+
19+
Download the appropriate binary for your architecture from [GitHub Releases](https://github.com/xmolecules/jmolecules-integrations/releases):
20+
21+
- **x86_64**: `jm-VERSION-linux-x86_64.tar.gz`
22+
- **ARM64**: `jm-VERSION-linux-aarch64.tar.gz`
23+
24+
```bash
25+
# Extract archive
26+
tar -xzf jm-VERSION-linux-x86_64.tar.gz
27+
28+
# Move binary to PATH
29+
sudo mv bin/jm /usr/local/bin/
30+
```
31+
32+
The bash completion file is included in `completion/jm.completion` and works in both bash and zsh.
33+
34+
### Windows
35+
36+
#### Scoop
37+
38+
```powershell
39+
scoop bucket add xmolecules https://github.com/xmolecules/scoop-bucket
40+
scoop install jm
41+
```
42+
43+
#### Manual Installation
44+
45+
Download `jm-VERSION-windows-x86_64.zip` from [GitHub Releases](https://github.com/xmolecules/jmolecules-integrations/releases):
46+
47+
1. Extract the archive
48+
2. Add the `bin` directory to your PATH
49+
50+
### Manual Download
51+
52+
Download pre-built binaries for all platforms from the [Releases page](https://github.com/xmolecules/jmolecules-integrations/releases).
53+
54+
## Usage
55+
56+
```bash
57+
# Initialize jMolecules in your project
58+
jm init
59+
60+
# Add a DDD aggregate
61+
jm add-aggregate <name> --package <package>
62+
63+
# Add a Spring Modulith module
64+
jm add-module --name <name>
65+
66+
# View configuration
67+
jm config
68+
69+
# Show help
70+
jm --help
71+
```
72+
73+
## Building from Source
74+
75+
Requires:
76+
- JDK 17+
77+
- GraalVM (for native image compilation)
78+
79+
```bash
80+
# Build JAR
81+
./mvnw clean package
82+
83+
# Build native binary
84+
./mvnw -Pdist clean package
85+
86+
# Binary output: target/jm (or target/jm.exe on Windows)
87+
```
88+
89+
## License
90+
91+
Apache License 2.0

jmolecules-cli/jreleaser.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
project:
2+
name: jm
3+
description: 'Command-line interface for jMolecules - DDD and architecture building blocks'
4+
longDescription: 'jMolecules CLI provides tools for working with Domain-Driven Design building blocks and architecture patterns in Java projects.'
5+
website: https://github.com/xmolecules/jmolecules-integrations
6+
authors:
7+
- Oliver Drotbohm
8+
license: Apache-2.0
9+
inceptionYear: 2025
10+
tags:
11+
- ddd
12+
- domain-driven-design
13+
- cli
14+
- java
15+
- architecture
16+
java:
17+
groupId: org.jmolecules.integrations
18+
artifactId: jmolecules-cli
19+
version: 17
20+
mainClass: org.jmolecules.cli.CliApplication
21+
22+
release:
23+
github:
24+
skipRelease: true
25+
update:
26+
enabled: true
27+
sections:
28+
- ASSETS
29+
overwrite: true
30+
31+
distributions:
32+
jm:
33+
type: NATIVE_IMAGE
34+
executable:
35+
name: jm
36+
windowsExtension: exe
37+
artifacts:
38+
- path: target/distributions/{{distributionName}}-{{projectVersion}}-darwin-x86_64.{{distributionArtifactFileFormat}}
39+
platform: osx-x86_64
40+
- path: target/distributions/{{distributionName}}-{{projectVersion}}-darwin-aarch64.{{distributionArtifactFileFormat}}
41+
platform: osx-aarch_64
42+
- path: target/distributions/{{distributionName}}-{{projectVersion}}-linux-x86_64.{{distributionArtifactFileFormat}}
43+
platform: linux-x86_64
44+
- path: target/distributions/{{distributionName}}-{{projectVersion}}-linux-aarch64.{{distributionArtifactFileFormat}}
45+
platform: linux-aarch_64
46+
- path: target/distributions/{{distributionName}}-{{projectVersion}}-windows-x86_64.{{distributionArtifactFileFormat}}
47+
platform: windows-x86_64
48+
49+
packagers:
50+
brew:
51+
active: ALWAYS
52+
continueOnError: false
53+
multiPlatform: true
54+
formulaName: jm
55+
templateDirectory: src/jreleaser/distributions/{{distributionName}}/brew
56+
repository:
57+
owner: xmolecules
58+
name: homebrew-tap
59+
tapName: xmolecules/jm
60+
commitMessage: '{{distributionName}} {{tagName}}'
61+
extraProperties:
62+
skipJava: true
63+
64+
scoop:
65+
active: ALWAYS
66+
continueOnError: false
67+
bucket:
68+
owner: xmolecules
69+
name: scoop-bucket
70+
commitMessage: '{{distributionName}} {{tagName}}'

0 commit comments

Comments
 (0)