Skip to content

Commit

Permalink
modify to use maven repo for publishing so everything is public. Host…
Browse files Browse the repository at this point in the history
…ed on OSSRH
  • Loading branch information
dekm committed Mar 26, 2024
1 parent bd54b72 commit ddf2c0d
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 43 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Maven Package
name: Maven Release Package

on:
release:
Expand All @@ -8,11 +8,10 @@ on:
workflow_dispatch:

jobs:
build:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
Expand All @@ -22,13 +21,14 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }}/pax-sdk # location for the settings.xml file
server-id: ossrh # Server ID from your settings.xml
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Imported from GitHub secrets
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} # Imported from GitHub secrets

- name: Build with Maven
run: mvn -B package -DskipTests --file pax-sdk/pom.xml
run: mvn clean install -B -P release --file pax-sdk/pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s pax-sdk/settings.xml --file pax-sdk/pom.xml
- name: Sign and Deploy to OSSRH
run: mvn deploy -B -P release --settings pax-sdk/settings.xml --file pax-sdk/pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
76 changes: 64 additions & 12 deletions pax-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,32 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.unigrid</groupId>
<artifactId>pax-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
<packaging>jar</packaging>
<!-- Project Information -->
<name>pax-sdk</name>
<description>A Java SDK to connect to the Unigrid Cosmos SDK Network</description>
<url>https://unigrid.org</url>
<!-- Developers Information -->
<developers>
<developer>
<id>dekm</id>
<name>Evan Green</name>
<email>[email protected]</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<!-- MAVEN CENTRAL -->
<scm>
<url>https://github.com/unigrid-project/pax-sdk-java</url>
<connection>scm:git:git://github.com/unigrid-project/pax-sdk-java.git</connection>
<developerConnection>scm:git:ssh://github.com:unigrid-project/pax-sdk-java.git</developerConnection>
</scm>

<dependencies>
<!-- gRPC dependencies -->
<dependency>
Expand Down Expand Up @@ -93,20 +112,15 @@
<!-- MAVEN PUBLISH -->

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/unigrid-project/pax-sdk-java</url>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<repositories>
<repository>
<id>github</id>
<name>Unigrid Cosmos SDK Java Apache Maven Packages</name>
<url>https://maven.pkg.github.com/unigrid-project/pax-sdk-java</url>
</repository>
</repositories>

<build>
<extensions>
Expand Down Expand Up @@ -566,6 +580,44 @@
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
27 changes: 5 additions & 22 deletions pax-sdk/settings.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<name>Unigrid Cosmos SDK Java Apache Maven Packages</name>
<url>https://maven.pkg.github.com/unigrid-project/pax-sdk-java</url>
</repository>
</repositories>
</profile>
</profiles>
<!-- other profiles if needed -->

<servers>
<server>
<id>github</id>
<!-- No need for a username when using GITHUB_TOKEN -->
<password>${env.GITHUB_TOKEN}</password>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
</servers>
</settings>
</settings>

0 comments on commit ddf2c0d

Please sign in to comment.