Skip to content

Commit

Permalink
Adds maven central publishing parts (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrongestNumber9 authored Nov 12, 2024
1 parent da31cd9 commit 0b8dc5d
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/upload_maven_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Upload Release

on:
release:
types: [published]

jobs:
upload:
name: Upload
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache Local Maven Repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

- name: Setup Signing
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Setup Maven Central
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'

server-id: central-sonatype-org
server-username: CENTRAL_SONATYPE_ORG_USERNAME
server-password: CENTRAL_SONATYPE_ORG_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Maven Central
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean deploy -Ppublish-maven-central
env:
CENTRAL_SONATYPE_ORG_USERNAME: ${{ secrets.CENTRAL_SONATYPE_ORG_USERNAME }}
CENTRAL_SONATYPE_ORG_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_ORG_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ hs_err_pid*

# macOS
.DS_Store

.flattened-pom.xml
129 changes: 129 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@
<name>aer_02</name>
<description>Azure EventHub to syslog bridge using Azure Java Function</description>
<url>https://teragrep.com</url>
<licenses>
<license>
<name>GNU Affero General Public License v3.0</name>
<url>https://github.com/teragrep/teragrep/blob/main/LICENSE</url>
</license>
</licenses>
<developers>
<developer>
<name>Mikko Kortelainen</name>
<email>[email protected]</email>
<organization>Teragrep</organization>
<organizationUrl>https://teragrep.com</organizationUrl>
</developer>
<developer>
<name>43</name>
<email>[email protected]</email>
<organization>Teragrep</organization>
<organizationUrl>https://teragrep.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/teragrep/aer_02.git</connection>
<developerConnection>scm:git:[email protected]:teragrep/aer_02.git</developerConnection>
<url>https://github.com/teragrep/aer_02/tree/master</url>
</scm>
<properties>
<changelist>-SNAPSHOT</changelist>
<functionAppName>aer_02-20241015142323079</functionAppName>
Expand Down Expand Up @@ -605,9 +630,113 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<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>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<source>8</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>bom</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten.clean</id>
<goals>
<goal>clean</goal>
</goals>
<phase>clean</phase>
</execution>
<execution>
<id>flatten</id>
<goals>
<goal>flatten</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>publish-maven-central</id>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central-sonatype-org</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>publish-github-packages</id>
<distributionManagement>
Expand Down

0 comments on commit 0b8dc5d

Please sign in to comment.