diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index eff34c8..0a1fc98 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,9 +1,11 @@
-name: Publish to GitHub Packages
+name: Publish to GitHub Packages and Maven Central
on:
push:
branches:
- main
+ release:
+ types: [created]
jobs:
build:
@@ -26,3 +28,28 @@ jobs:
run: mvn deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ publish-to-maven-central:
+ runs-on: ubuntu-latest
+ needs: build
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Publish to Maven Central
+ run: mvn deploy
+ env:
+ OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
+ OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
+ GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
+ GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
diff --git a/README.md b/README.md
index c1bb5c7..bf533d8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# nengen
The 4th iteration of virtual cardboard's Java game engine. This LWJGL-based engine is an organized yet flexible alternative to LibGDX.
-## Automatic Deployment to GitHub Packages
+## Automatic Deployment to GitHub Packages and Maven Central
-This project is configured to automatically deploy to GitHub Packages using GitHub Actions on each commit to the `main` branch. No manual deployment steps are required.
+This project is configured to automatically deploy to GitHub Packages and Maven Central using GitHub Actions on each commit to the `main` branch. No manual deployment steps are required.
diff --git a/pom.xml b/pom.xml
index 536d172..23c506e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -223,6 +223,29 @@
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
+
+ ossrh
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
@@ -232,6 +255,14 @@
GitHub Packages
https://maven.pkg.github.com/virtual-cardboard/nengen
+
+ ossrh
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
diff --git a/settings.xml b/settings.xml
index 180bec7..0a9b381 100644
--- a/settings.xml
+++ b/settings.xml
@@ -5,5 +5,10 @@
${env.GITHUB_ACTOR}
${env.GITHUB_TOKEN}
+
+ ossrh
+ ${env.OSSRH_USERNAME}
+ ${env.OSSRH_PASSWORD}
+