Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit 8bdbaa9

Browse files
feat: add Maven package publishing to GitHub Packages
- Add pom.xml with proper Maven project configuration - All JUNG/commons dependencies from Maven Central - Local JAR install profile for vendored deps (dump, j3d-core) - maven-shade-plugin for fat JAR with all dependencies - Source and Javadoc JAR generation - GitHub Packages distribution management - Add publish.yml workflow triggered on release or manual dispatch - Installs local vendored JARs, builds, publishes to GitHub Packages - Attaches fat JAR and slim JAR to GitHub releases - Supports version override via workflow_dispatch input - Add settings.xml for GitHub Packages authentication - Update README with Maven dependency and fat JAR usage instructions
1 parent 9420050 commit 8bdbaa9

4 files changed

Lines changed: 447 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish to GitHub Packages
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish (e.g., 1.1.0)'
10+
required: false
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
publish:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up JDK 11
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '11'
29+
distribution: 'temurin'
30+
server-id: github
31+
settings-path: ${{ github.workspace }}
32+
33+
- name: Install local vendored JARs
34+
run: |
35+
mvn initialize -P install-local-deps -B
36+
37+
- name: Set version from release tag
38+
if: github.event_name == 'release'
39+
run: |
40+
VERSION="${{ github.event.release.tag_name }}"
41+
VERSION="${VERSION#v}"
42+
mvn versions:set -DnewVersion="$VERSION" -B
43+
44+
- name: Set version from input
45+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
46+
run: |
47+
mvn versions:set -DnewVersion="${{ github.event.inputs.version }}" -B
48+
49+
- name: Build package
50+
run: mvn package -B -DskipTests
51+
52+
- name: Publish to GitHub Packages
53+
run: mvn deploy -B -DskipTests -s ${{ github.workspace }}/settings.xml
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Upload JAR artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: graphvisual-jars
61+
path: |
62+
target/*.jar
63+
!target/original-*.jar
64+
retention-days: 90
65+
66+
- name: Attach JAR to release
67+
if: github.event_name == 'release'
68+
env:
69+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
run: |
71+
# Upload the shaded (fat) JAR to the release
72+
FAT_JAR=$(ls target/*-all.jar 2>/dev/null | head -1)
73+
if [ -n "$FAT_JAR" ]; then
74+
gh release upload "${{ github.event.release.tag_name }}" "$FAT_JAR" --clobber
75+
fi
76+
# Upload the slim JAR too
77+
SLIM_JAR=$(ls target/graphvisual-*.jar 2>/dev/null | grep -v all | grep -v sources | grep -v javadoc | grep -v original | head -1)
78+
if [ -n "$SLIM_JAR" ]; then
79+
gh release upload "${{ github.event.release.tag_name }}" "$SLIM_JAR" --clobber
80+
fi

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,59 @@ java -cp "build/classes:build/test/classes:$(find lib -name '*.jar' | tr '\n' ':
205205
org.junit.runner.JUnitCore app.UtilMethodsTest gvisual.EdgeTest
206206
```
207207

208+
## Maven / GitHub Packages
209+
210+
GraphVisual is published to [GitHub Packages](https://github.com/sauravbhattacharya001/GraphVisual/packages) as a Maven artifact. You can use it as a library dependency or download the fat JAR directly.
211+
212+
### Add as a Maven dependency
213+
214+
1. Configure GitHub Packages in your `~/.m2/settings.xml`:
215+
216+
```xml
217+
<servers>
218+
<server>
219+
<id>github</id>
220+
<username>YOUR_GITHUB_USERNAME</username>
221+
<password>YOUR_GITHUB_TOKEN</password>
222+
</server>
223+
</servers>
224+
```
225+
226+
2. Add the repository and dependency to your `pom.xml`:
227+
228+
```xml
229+
<repositories>
230+
<repository>
231+
<id>github</id>
232+
<url>https://maven.pkg.github.com/sauravbhattacharya001/GraphVisual</url>
233+
</repository>
234+
</repositories>
235+
236+
<dependency>
237+
<groupId>com.github.sauravbhattacharya001</groupId>
238+
<artifactId>graphvisual</artifactId>
239+
<version>1.1.0</version>
240+
</dependency>
241+
```
242+
243+
### Download the fat JAR
244+
245+
Each [release](https://github.com/sauravbhattacharya001/GraphVisual/releases) includes a standalone `graphvisual-*-all.jar` with all dependencies bundled:
246+
247+
```bash
248+
java -jar graphvisual-1.1.0-all.jar
249+
```
250+
251+
### Build with Maven locally
252+
253+
```bash
254+
# Install vendored local JARs first
255+
mvn initialize -P install-local-deps
256+
257+
# Build the project
258+
mvn package -B
259+
```
260+
208261
## Docker
209262

210263
### Build

0 commit comments

Comments
 (0)