Skip to content

Commit 1f862f8

Browse files
committed
Update Maven configuration to use Maven Central like JFalkorDB
- Changed distributionManagement to use central.sonatype.com - Added GPG signing plugin for artifact signing - Added central-publishing-maven-plugin for Maven Central publishing - Updated publish workflow to use CENTRAL_USERNAME/CENTRAL_TOKEN - Updated release workflow with GPG key import and Maven Central deployment - Removed old Spring Artifactory settings.xml This matches the publishing configuration used by the JFalkorDB project for Maven Central publishing.
1 parent 566e92a commit 1f862f8

File tree

4 files changed

+70
-68
lines changed

4 files changed

+70
-68
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ jobs:
4242
java-version: '17'
4343
distribution: 'temurin'
4444
cache: 'maven'
45+
server-id: central
46+
server-username: CENTRAL_USERNAME
47+
server-password: CENTRAL_TOKEN
4548

4649
- name: Build and Deploy to Maven Repository
4750
run: |
48-
./mvnw -s settings.xml clean deploy -U -B -Dcheckstyle.skip=true -Dmaven.javadoc.skip=false
51+
./mvnw -DskipTests -Dgpg.skip=true clean deploy -U -B -Dcheckstyle.skip=true
4952
echo "### Publish Summary :package:" >> $GITHUB_STEP_SUMMARY
50-
echo "Successfully published artifacts to Maven repository!" >> $GITHUB_STEP_SUMMARY
53+
echo "Successfully published artifacts to Maven Central!" >> $GITHUB_STEP_SUMMARY
5154
echo "- Version: 1.0.0-SNAPSHOT" >> $GITHUB_STEP_SUMMARY
5255
echo "- Branch: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
5356
env:
5457
SDF_FALKORDB_VERSION: latest
55-
ARTIFACTORY_USR: ${{ secrets.ARTIFACTORY_USERNAME }}
56-
ARTIFACTORY_PSW: ${{ secrets.ARTIFACTORY_PASSWORD }}
58+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
59+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
5760

5861
- name: Upload Artifacts
5962
if: success()

.github/workflows/release.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
2121

22-
- name: Set up JDK 17
22+
- name: Set up JDK 17 for publishing to Maven Central
2323
uses: actions/setup-java@v4
2424
with:
2525
java-version: 17
2626
distribution: 'temurin'
27+
cache: maven
28+
server-id: central
29+
server-username: CENTRAL_USERNAME
30+
server-password: CENTRAL_TOKEN
2731

2832
- name: Cache Maven dependencies
2933
uses: actions/cache@v4
@@ -38,6 +42,23 @@ jobs:
3842
sudo apt-get update
3943
sudo apt-get install -y redis-tools
4044
45+
- name: Get version from tag
46+
id: get_version
47+
run: |
48+
realversion="${GITHUB_REF/refs\/tags\/v/}"
49+
echo "VERSION=$realversion" >> $GITHUB_OUTPUT
50+
51+
- name: Update version in POM
52+
if: github.event_name == 'release'
53+
run: ./mvnw versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
54+
55+
- name: Import GPG key
56+
if: github.event_name == 'release'
57+
uses: crazy-max/ghaction-import-gpg@v6
58+
with:
59+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
60+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
61+
4162
- name: Start FalkorDB
4263
run: |
4364
docker run -d --name falkordb -p 6379:6379 falkordb/falkordb:latest
@@ -51,16 +72,17 @@ jobs:
5172
env:
5273
MAVEN_OPTS: -Xmx1024m
5374

54-
- name: Build and Package
55-
run: ./mvnw clean package -DskipTests -B -P release
56-
57-
- name: Upload Release Assets
75+
- name: Build and deploy to Maven Central
5876
if: github.event_name == 'release'
59-
uses: actions/upload-release-asset@v1
77+
run: |
78+
./mvnw --no-transfer-progress \
79+
--batch-mode \
80+
clean deploy -P release
6081
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
with:
63-
upload_url: ${{ github.event.release.upload_url }}
64-
asset_path: target/spring-data-falkordb-*.jar
65-
asset_name: spring-data-falkordb-${{ github.event.release.tag_name }}.jar
66-
asset_content_type: application/java-archive
82+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
83+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
84+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
85+
86+
- name: Build artifacts for workflow dispatch
87+
if: github.event_name == 'workflow_dispatch'
88+
run: ./mvnw clean package -DskipTests -B -P release

pom.xml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@
6969

7070
<distributionManagement>
7171
<repository>
72-
<id>spring-libs-release</id>
73-
<name>Spring Release Repository</name>
74-
<url>https://repo.spring.io/libs-release-local</url>
72+
<id>central</id>
73+
<url>https://central.sonatype.com/api/v1/publisher/upload/</url>
7574
</repository>
7675
<snapshotRepository>
77-
<id>spring-libs-snapshot</id>
78-
<name>Spring Snapshot Repository</name>
79-
<url>https://repo.spring.io/libs-snapshot-local</url>
76+
<id>central</id>
77+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
8078
</snapshotRepository>
8179
</distributionManagement>
8280

@@ -803,6 +801,31 @@
803801
</execution>
804802
</executions>
805803
</plugin>
804+
<plugin>
805+
<groupId>org.apache.maven.plugins</groupId>
806+
<artifactId>maven-gpg-plugin</artifactId>
807+
<version>3.2.8</version>
808+
<executions>
809+
<execution>
810+
<id>sign-artifacts</id>
811+
<goals>
812+
<goal>sign</goal>
813+
</goals>
814+
<phase>verify</phase>
815+
</execution>
816+
</executions>
817+
</plugin>
818+
<plugin>
819+
<groupId>org.sonatype.central</groupId>
820+
<artifactId>central-publishing-maven-plugin</artifactId>
821+
<version>0.9.0</version>
822+
<extensions>true</extensions>
823+
<configuration>
824+
<publishingServerId>central</publishingServerId>
825+
<autoPublish>true</autoPublish>
826+
<waitUntil>published</waitUntil>
827+
</configuration>
828+
</plugin>
806829
</plugins>
807830
</build>
808831
</profile>

settings.xml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)