diff --git a/.github/workflows/gh-mvn-publish.yml b/.github/workflows/gh-mvn-publish.yml
new file mode 100644
index 0000000..3070e3e
--- /dev/null
+++ b/.github/workflows/gh-mvn-publish.yml
@@ -0,0 +1,58 @@
+name: Release Artifacts to GitHub Maven Packages
+
+on:
+ release:
+ types: [ created ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ server-id: github
+ settings-path: ${{ github.workspace }}
+
+ - name: maven-settings-xml-action
+ uses: whelk-io/maven-settings-xml-action@v22
+ with:
+ servers: '[{ "id": "${repo.id}", "username": "${repo.user}", "password": "${repo.pass}" }]'
+
+ - name: Find and Replace
+ uses: jacobtomlinson/gha-find-replace@v3
+ with:
+ find: "ollama4j-revision"
+ replace: ${{ github.ref_name }}
+ regex: false
+
+ - name: Find and Replace
+ uses: jacobtomlinson/gha-find-replace@v3
+ with:
+ find: "mvn-repo-id"
+ replace: github
+ regex: false
+
+ - name: Import GPG key
+ uses: crazy-max/ghaction-import-gpg@v6
+ with:
+ gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
+ passphrase: ${{ secrets.GPG_PASSPHRASE }}
+ - name: List keys
+ run: gpg -K
+
+ - name: Build with Maven
+ run: mvn --file pom.xml -U clean package -Punit-tests
+
+ - name: Publish to GitHub Packages Apache Maven
+ run: mvn deploy -Punit-tests -s $GITHUB_WORKSPACE/settings.xml -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Drepo.id=github -Drepo.user=${{ secrets.GH_MVN_USER }} -Drepo.pass=${{ secrets.GH_MVN_PASS }} -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/ollama4j/ollama4j
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml
index 7b2466a..036ccb6 100644
--- a/.github/workflows/maven-publish.yml
+++ b/.github/workflows/maven-publish.yml
@@ -1,22 +1,31 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
-name: Release Artifacts
+name: Release Artifacts to Maven Central
on:
release:
types: [ created ]
+
+#on:
+# pull_request:
+# types: [ opened, reopened ]
+# branches: [ "main" ]
+
+
jobs:
build:
runs-on: ubuntu-latest
+
permissions:
- contents: read
+ contents: write
packages: write
steps:
- uses: actions/checkout@v3
+
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
@@ -25,6 +34,19 @@ jobs:
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
+ - name: maven-settings-xml-action
+ uses: whelk-io/maven-settings-xml-action@v22
+ with:
+ servers: '[{ "id": "${repo.id}", "username": "${repo.user}", "password": "${repo.pass}" }]'
+
+ - name: Import GPG key
+ uses: crazy-max/ghaction-import-gpg@v6
+ with:
+ gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
+ passphrase: ${{ secrets.GPG_PASSPHRASE }}
+ - name: List keys
+ run: gpg -K
+
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
@@ -32,10 +54,42 @@ jobs:
replace: ${{ github.ref_name }}
regex: false
- - name: Build with Maven
- run: mvn --file pom.xml -U clean package -Punit-tests
+ - name: Find and Replace
+ uses: jacobtomlinson/gha-find-replace@v3
+ with:
+ find: "mvn-repo-id"
+ replace: central
+ regex: false
- - name: Publish to GitHub Packages Apache Maven
- run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml --file pom.xml
+ - name: Publish to Maven Central
+ run: mvn deploy -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Drepo.id=central -Drepo.user=${{ secrets.MVN_USER }} -Drepo.pass=${{ secrets.MVN_PASS }}
+
+ - name: Upload Release Asset - JAR
+ uses: actions/upload-release-asset@v1
env:
- GITHUB_TOKEN: ${{ github.token }}
\ No newline at end of file
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: target/ollama4j-${{ github.ref_name }}.jar
+ asset_name: ollama4j-${{ github.ref_name }}.jar
+ asset_content_type: application/x-jar
+
+ - name: Upload Release Asset - Javadoc JAR
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: target/ollama4j-${{ github.ref_name }}-javadoc.jar
+ asset_name: ollama4j-${{ github.ref_name }}-javadoc.jar
+ asset_content_type: application/x-jar
+
+ - name: Upload Release Asset - Sources JAR
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: target/ollama4j-${{ github.ref_name }}-sources.jar
+ asset_name: ollama4j-${{ github.ref_name }}-sources.jar
+ asset_content_type: application/x-jar
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5b70591..231756a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- io.github.amithkoujalgi
+ io.github.ollama4j
ollama4j
ollama4j-revision
@@ -41,7 +41,7 @@
scm:git:git@github.com:amithkoujalgi/ollama4j.git
scm:git:https://github.com/amithkoujalgi/ollama4j.git
https://github.com/amithkoujalgi/ollama4j
- v1.0.16
+ ollama4j-revision
@@ -72,27 +72,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
org.apache.maven.plugins
@@ -129,15 +109,23 @@
-
-
-
-
-
-
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.5
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
@@ -189,27 +177,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
- github
- GitHub Packages
- https://maven.pkg.github.com/amithkoujalgi/ollama4j
+ mvn-repo-id
+
+ ossrh
+
+ true
+
+
+ gpg2
+ unit
+ false
+ true
+
+
+
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.5.0
+ true
+
+ mvn-repo-id
+ false
+
+
+
+
+
unit-tests
@@ -218,7 +218,7 @@
true
- true
+ false
@@ -261,39 +261,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 3.1.0
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+ --pinentry-mode
+ loopback
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.13
+ true
+
+ ossrh
+ https://s01.oss.sonatype.org/
+ true
+
+
org.jacoco