diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..d18db78
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,168 @@
+name: Release Library
+run-name: Release ${{ github.ref_name != github.event.repository.default_branch && 'snapshot ' || '' }}${{ github.ref_name }} by @${{ github.actor }}
+
+on:
+ workflow_dispatch:
+ inputs:
+ version_bump:
+ description: 'Version bump type - only for main branch'
+ required: true
+ type: choice
+ options:
+ - patch
+ - minor
+ - major
+ default: patch
+
+permissions:
+ contents: write
+ packages: write
+
+jobs:
+ release:
+ name: Build and Release
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.version.outputs.version }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 1
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v5
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ cache: 'maven'
+
+ - name: Configure Git
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+
+ - name: Determine version
+ id: version
+ env:
+ DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
+ CURRENT_BRANCH: ${{ github.ref_name }}
+ run: |
+ # Get the latest tag
+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
+ echo "Latest tag: $LATEST_TAG"
+
+ # Remove 'v' prefix if present
+ LATEST_VERSION=${LATEST_TAG#v}
+ echo "Latest version: $LATEST_VERSION"
+
+ # Parse version components
+ IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
+
+ # Determine if we're on the default branch
+ if [ "$CURRENT_BRANCH" = "$DEFAULT_BRANCH" ]; then
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ BUMP_TYPE="${{ inputs.version_bump }}"
+ else
+ BUMP_TYPE="patch"
+ fi
+
+ case $BUMP_TYPE in
+ major)
+ MAJOR=$((MAJOR + 1))
+ MINOR=0
+ PATCH=0
+ ;;
+ minor)
+ MINOR=$((MINOR + 1))
+ PATCH=0
+ ;;
+ patch)
+ PATCH=$((PATCH + 1))
+ ;;
+ esac
+
+ NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
+ IS_RELEASE=true
+ else
+ # Snapshot build - increment patch and add -SNAPSHOT
+ PATCH=$((PATCH + 1))
+ NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}-SNAPSHOT"
+ IS_RELEASE=false
+ fi
+
+ echo "New version: $NEW_VERSION"
+ echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
+ echo "is_release=$IS_RELEASE" >> $GITHUB_OUTPUT
+ echo "bump_type=${BUMP_TYPE:-none}" >> $GITHUB_OUTPUT
+
+ - name: "Build and test (version: ${{ steps.version.outputs.version }})"
+ env:
+ VERSION: ${{ steps.version.outputs.version }}
+ run: |
+ mvn clean verify -B -Drevision=$VERSION
+
+ - name: Publish to GitHub Packages
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_ACTOR: ${{ github.actor }}
+ VERSION: ${{ steps.version.outputs.version }}
+ run: |
+ mvn deploy -DskipTests -B -Drevision=$VERSION
+
+ - name: Create and push tag (release only)
+ env:
+ VERSION: ${{ steps.version.outputs.version }}
+ if: steps.version.outputs.is_release == 'true'
+ run: |
+ VERSION="${{ steps.version.outputs.version }}"
+ git tag -a "v$VERSION" -m "Release version $VERSION"
+ git push origin "v$VERSION"
+
+ - name: Create GitHub Release (release only)
+ if: steps.version.outputs.is_release == 'true'
+ uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
+ with:
+ tag: v${{ steps.version.outputs.version }}
+ name: Release ${{ steps.version.outputs.version }}
+ body: |
+ ## Release ${{ steps.version.outputs.version }}
+
+ ### Changes
+ This release was automatically generated.
+
+ ### Maven Dependency
+ ```xml
+
+ net.airvantage
+ proxy-socket-core
+ ${{ steps.version.outputs.version }}
+
+ ```
+
+ ### GitHub Packages
+ To use this library from GitHub Packages, add the following repository to your `pom.xml`:
+ ```xml
+
+
+ github
+ https://maven.pkg.github.com/${{ github.repository }}
+
+
+ ```
+ draft: false
+ prerelease: false
+ generateReleaseNotes: true
+
+ - name: Summary
+ env:
+ VERSION: ${{ steps.version.outputs.version }}
+ if: always()
+ run: |
+ echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "- **Version**: $VERSION" >> $GITHUB_STEP_SUMMARY
+ echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
+ echo "- **Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
+ echo "- **Repository**: https://github.com/${{ github.repository }}/packages" >> $GITHUB_STEP_SUMMARY
diff --git a/pom.xml b/pom.xml
index f699fb8..2b9efea 100755
--- a/pom.xml
+++ b/pom.xml
@@ -7,13 +7,27 @@
net.airvantage
proxy-socket-java
- 1.0.0-SNAPSHOT
+ ${revision}
pom
ProxyProtocol Java implementation.
+
+
+ github
+ GitHub Packages
+ https://maven.pkg.github.com/${github.repository}
+
+
+
+
+ 0.0.0-SNAPSHOT
+
+
+ airvantage/proxy-socket-java
+
5.10.3
33.5.0-jre
@@ -79,7 +93,6 @@
-
diff --git a/proxy-socket-core/pom.xml b/proxy-socket-core/pom.xml
index b101eed..0e2ffa2 100644
--- a/proxy-socket-core/pom.xml
+++ b/proxy-socket-core/pom.xml
@@ -6,7 +6,7 @@
net.airvantage
proxy-socket-java
- 1.0.0-SNAPSHOT
+ ${revision}
proxy-socket-core
Proxy Protocol - Core
diff --git a/proxy-socket-guava/pom.xml b/proxy-socket-guava/pom.xml
index ec11468..7246c15 100644
--- a/proxy-socket-guava/pom.xml
+++ b/proxy-socket-guava/pom.xml
@@ -6,7 +6,7 @@
net.airvantage
proxy-socket-java
- 1.0.0-SNAPSHOT
+ ${revision}
proxy-socket-guava
Proxy Protocol - Guava Cache
diff --git a/proxy-socket-udp/pom.xml b/proxy-socket-udp/pom.xml
index 372385e..58fc62c 100644
--- a/proxy-socket-udp/pom.xml
+++ b/proxy-socket-udp/pom.xml
@@ -6,7 +6,7 @@
net.airvantage
proxy-socket-java
- 1.0.0-SNAPSHOT
+ ${revision}
proxy-socket-udp
Proxy Protocol - UDP