Skip to content

Commit 4ea2d41

Browse files
committed
build: first version of JReleaser config
1 parent 90e9087 commit 4ea2d41

6 files changed

Lines changed: 434 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ jobs:
2424
distribution: 'temurin'
2525
cache: maven
2626

27+
- name: Grant execute permission for mvnw
28+
if: runner.os != 'Windows'
29+
run: chmod +x mvnw
30+
2731
- name: Build with Maven
28-
run: mvn -B verify --file pom.xml
32+
run: ./mvnw -B verify --file pom.xml
2933

3034
- name: Publish Test Results
3135
uses: EnricoMi/publish-unit-test-result-action@v2

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g., 1.0.0)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write # Required to create releases and push commits
17+
18+
# Optional: Use environment for additional protection
19+
# environment: jreleaser
20+
21+
env:
22+
# GitHub token (automatically provided)
23+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
# Required for Maven Central deployment
26+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
27+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
28+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
29+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }}
30+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }}
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0 # Full history for changelog generation
37+
38+
- name: Set up JDK 21
39+
uses: actions/setup-java@v4
40+
with:
41+
java-version: '21'
42+
distribution: 'temurin'
43+
cache: maven
44+
45+
- name: Set release version
46+
run: ./mvnw --no-transfer-progress --batch-mode versions:set -DnewVersion=${{ github.event.inputs.version }}
47+
48+
- name: Build and assemble
49+
run: ./mvnw --no-transfer-progress --batch-mode clean deploy jreleaser:assemble -Prelease
50+
51+
- name: Commit & Push changes
52+
run: |
53+
git config --global user.name "github-actions[bot]"
54+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
55+
git add pom.xml
56+
git commit -m "ci: Releasing version ${{ github.event.inputs.version }}"
57+
git push
58+
59+
- name: Run JReleaser
60+
run: ./mvnw jreleaser:full-release
61+
62+
- name: Set next development version
63+
run: ./mvnw --no-transfer-progress --batch-mode build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
64+
65+
- name: Commit & Push changes
66+
run: |
67+
git add pom.xml
68+
git commit -m "ci: Prepare for next development iteration"
69+
git push
70+
71+
- name: Upload JReleaser output
72+
if: always()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: jreleaser-output
76+
path: |
77+
target/jreleaser/trace.log
78+
target/jreleaser/output.properties
79+
retention-days: 7

README.md

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
# Java Transparent Proxy
22

3-
A lightweight HTTP/HTTPS proxy library with pluggable interceptors and full MITM HTTPS support, built on Jetty 11 and Java 21 virtual threads.
3+
A lightweight HTTP/HTTPS proxy library with pluggable interceptors and full MITM HTTPS support.
44

55
## Features
66

7-
- **HTTP Proxy** — Full HTTP/1.1 proxy with RFC 7230 hop-by-hop header filtering
7+
- **HTTP Proxy** — Full HTTP/1.1 proxy
88
- **HTTPS Interception** — Man-in-the-Middle mode with on-the-fly certificate generation
99
- **HTTPS Pass-through** — Secure tunneling via CONNECT (no decryption)
1010
- **Pluggable Interceptors** — Chain-of-responsibility for inspecting/modifying requests and responses
11-
- **Virtual Threads** — Java 21 virtual threads for high concurrency
1211
- **Certificate Authority** — Auto-generated CA with per-hostname server certificates (BouncyCastle)
1312

14-
## Requirements
15-
16-
- Java 21+
17-
- Maven 3.6+
18-
1913
## Usage
2014

2115
### Basic HTTP Proxy
@@ -145,29 +139,10 @@ proxy.start(8080); // HTTPS passes through unmodified
145139
./mvnw package # Package JAR
146140
```
147141

148-
## Project Structure
149-
150-
```
151-
src/main/java/org/codejive/tproxy/
152-
├── HttpProxy.java # Main proxy class
153-
├── ProxyServer.java # Jetty server setup
154-
├── Interceptor.java # Interceptor interface
155-
├── InterceptorChain.java # Chain-of-responsibility
156-
├── ProxyRequest.java # Immutable request model
157-
├── ProxyResponse.java # Immutable response model
158-
├── Headers.java # Case-insensitive header map
159-
├── HeaderFilter.java # RFC 7230 header filtering
160-
├── CertificateAuthority.java # CA and cert generation
161-
├── CertificateGeneratingKeyManager.java # SNI-based dynamic certs
162-
└── InterceptingConnectHandler.java # MITM CONNECT handler
163-
```
164-
165-
## Dependencies
142+
## Requirements
166143

167-
- **Jetty 11.0.24** — HTTP server, proxy, servlet
168-
- **BouncyCastle 1.78.1** — Certificate generation
169-
- **SLF4J 2.0.17** — Logging
170-
- **JUnit 5 / AssertJ / WireMock 3.4.2** — Testing
144+
- Java 21+
145+
- Maven 3.6+
171146

172147
## License
173148

RELEASE.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Release Process
2+
3+
This project uses [JReleaser](https://jreleaser.org/) for automated releases to GitHub and Maven Central.
4+
5+
## Prerequisites
6+
7+
Ensure GitHub secrets are configured (see First-Time Setup below if not already configured).
8+
9+
## Creating a Release
10+
11+
1. **Ensure all changes are committed and pushed**
12+
13+
```bash
14+
git status # Should be clean
15+
```
16+
17+
2. **Trigger the release workflow**
18+
- Go to [Actions → Release](../../actions/workflows/release.yml)
19+
- Click **Run workflow**
20+
- Enter the release version (e.g., `1.0.0`)
21+
- Click **Run workflow**
22+
23+
3. **Monitor the workflow**
24+
- The workflow will:
25+
- Update version in pom.xml
26+
- Build and sign artifacts
27+
- Deploy to Maven Central
28+
- Create GitHub release with changelog
29+
- Bump to next SNAPSHOT version
30+
31+
4. **Verify the release**
32+
- Check [GitHub Releases](../../releases)
33+
- Check Maven Central (may take ~30 minutes)
34+
35+
## Local Testing (Optional)
36+
37+
Test the configuration before releasing:
38+
39+
```bash
40+
# Validate configuration
41+
./mvnw jreleaser:config
42+
43+
# Test build with release profile
44+
./mvnw clean install -Prelease
45+
46+
# Check assembled artifacts
47+
ls -la target/staging-deploy/
48+
```
49+
50+
## First-Time Setup
51+
52+
### 1. Generate GPG Keys
53+
54+
```bash
55+
# Generate key
56+
gpg --gen-key
57+
58+
# Get key ID
59+
gpg --list-secret-keys --keyid-format=long
60+
61+
# Export keys
62+
gpg --armor --export YOUR_KEY_ID > public.key
63+
gpg --armor --export-secret-keys YOUR_KEY_ID > private.key
64+
65+
# Publish to key server
66+
gpg --keyserver keyserver.ubuntu.com --send-keys YOUR_KEY_ID
67+
```
68+
69+
### 2. Register at Maven Central
70+
71+
1. Sign up at https://central.sonatype.com/
72+
2. Verify ownership of your namespace (e.g., `org.codejive.tproxy`)
73+
3. Get username and password/token
74+
75+
### 3. Configure GitHub Secrets
76+
77+
Add these secrets at [Settings → Secrets and variables → Actions](../../settings/secrets/actions):
78+
79+
| Secret Name | Description | How to Get It |
80+
| ----------- | ----------- | ------------- |
81+
| `GPG_PUBLIC_KEY` | Your GPG public key | Copy entire contents of `public.key` file |
82+
| `GPG_SECRET_KEY` | Your GPG private key | Copy entire contents of `private.key` file |
83+
| `GPG_PASSPHRASE` | Passphrase for your GPG key | The passphrase you entered when generating the key |
84+
| `MAVENCENTRAL_USERNAME` | Maven Central username | From your Maven Central account token |
85+
| `MAVENCENTRAL_PASSWORD` | Maven Central password | From your Maven Central account token |
86+
87+
**Note:** The `GITHUB_TOKEN` is automatically provided by GitHub Actions and doesn't need to be configured.
88+
89+
### 4. Optional: Create a Protected Environment
90+
91+
For additional security, you can create a protected environment:
92+
93+
1. Go to Settings → Environments
94+
2. Click "New environment"
95+
3. Name it `jreleaser`
96+
4. Add protection rules:
97+
- ✅ Required reviewers (recommended for production releases)
98+
- ✅ Wait timer (optional delay before deployment)
99+
5. Add the same secrets to this environment
100+
101+
Then uncomment this line in `.github/workflows/release.yml`:
102+
103+
```yaml
104+
# environment: jreleaser
105+
```
106+
107+
## Version Management
108+
109+
- Development versions use `-SNAPSHOT` suffix (e.g., `1.0.0-SNAPSHOT`)
110+
- Release versions have no suffix (e.g., `1.0.0`)
111+
- The workflow automatically bumps to next SNAPSHOT after release
112+
- Use [semantic versioning](https://semver.org/): MAJOR.MINOR.PATCH

jreleaser.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# JReleaser configuration for java-tproxy library
2+
# Publishes to Maven Central and GitHub Releases
3+
# Requires GPG signing for Maven Central
4+
5+
project:
6+
name: tproxy
7+
description: A lightweight HTTP/HTTPS proxy library with pluggable interceptors and full MITM HTTPS support
8+
longDescription: |
9+
Java Transparent Proxy is a lightweight HTTP/HTTPS proxy library.
10+
11+
Key features:
12+
- Full HTTP/1.1 proxy
13+
- Man-in-the-Middle mode with on-the-fly certificate generation for HTTPS interception
14+
- Secure tunneling via CONNECT for HTTPS pass-through (no decryption)
15+
- Pluggable interceptors with chain-of-responsibility pattern
16+
- Auto-generated CA with per-hostname server certificates using BouncyCastle
17+
authors:
18+
- Tako Schotanus
19+
tags:
20+
- java
21+
- proxy
22+
- http
23+
- https
24+
- mitm
25+
- interceptor
26+
- library
27+
license: Apache-2.0
28+
links:
29+
homepage: https://github.com/codejive/java-tproxy
30+
java:
31+
groupId: org.codejive.tproxy
32+
version: '21'
33+
inceptionYear: '2026'
34+
stereotype: NONE
35+
36+
# No assembly needed for libraries - Maven handles JARs
37+
assemble:
38+
enabled: false
39+
40+
# Maven Central deployment configuration
41+
deploy:
42+
maven:
43+
mavenCentral:
44+
tproxy:
45+
active: RELEASE # Only deploy non-SNAPSHOT versions
46+
url: https://central.sonatype.com/api/v1/publisher
47+
stagingRepositories:
48+
- target/staging-deploy
49+
50+
# GitHub release configuration
51+
release:
52+
github:
53+
owner: codejive
54+
name: java-tproxy
55+
overwrite: true
56+
changelog:
57+
formatted: ALWAYS
58+
preset: conventional-commits
59+
contributors:
60+
format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}'
61+
62+
# Checksum generation
63+
checksum:
64+
individual: true
65+
66+
# GPG signing - REQUIRED for Maven Central
67+
signing:
68+
active: ALWAYS
69+
armored: true
70+
71+
# No distributions section needed for library-only projects

0 commit comments

Comments
 (0)