Skip to content

Commit baba141

Browse files
committed
Publish release artefacts workflow
1 parent 8da2765 commit baba141

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on version tags like v1.11.0
7+
workflow_dispatch: # Allow manual trigger for emergency republishing
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: 17
21+
distribution: 'temurin'
22+
cache: 'maven'
23+
server-id: central
24+
server-username: MAVEN_USERNAME
25+
server-password: MAVEN_PASSWORD
26+
27+
- name: Import GPG key
28+
run: |
29+
# Debug: Check if secret is present (shows length, not content)
30+
echo "GPG_PRIVATE_KEY length: ${#GPG_PRIVATE_KEY}"
31+
32+
# Decode and import
33+
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
34+
35+
# List imported keys
36+
echo "Imported keys:"
37+
gpg --list-secret-keys --keyid-format LONG
38+
env:
39+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
40+
41+
- name: Publish to Maven Central
42+
env:
43+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
44+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
45+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
46+
run: |
47+
mvn -P release \
48+
--batch-mode \
49+
--no-transfer-progress \
50+
-Dgpg.passphrase="${MAVEN_GPG_PASSPHRASE}" \
51+
clean deploy
52+
53+
- name: Create GitHub Release
54+
uses: softprops/action-gh-release@v1
55+
with:
56+
generate_release_notes: true
57+
files: |
58+
**/target/*.jar
59+
**/target/*.pom

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,26 @@ The `JTS` class supports conversion from/to JTS `Geometry` instances.
228228
org.geolatte.geom.Point<G2D> glPnt2=JTS.from(jtsPoint,WGS84);
229229
```
230230

231+
# Releasing
232+
233+
Releases are published automatically to Maven Central via GitHub Actions when a version tag is pushed:
234+
235+
```bash
236+
# Create and push a version tag
237+
git tag -a v1.11.0 -m "Release version 1.11.0"
238+
git push origin v1.11.0
239+
```
240+
241+
The GitHub Actions workflow will:
242+
1. Build the project with Java 17
243+
2. Run all tests
244+
3. Generate source and JavaDoc JARs
245+
4. Sign all artifacts with GPG
246+
5. Publish to Maven Central
247+
6. Create a GitHub Release
248+
249+
Artifacts typically appear on Maven Central within 15-30 minutes.
250+
231251

232252

233253

0 commit comments

Comments
 (0)