Skip to content

Commit

Permalink
Merge pull request #35 from cardano-foundation/feat/publish-to-maven-…
Browse files Browse the repository at this point in the history
…central

Feat/publish to maven central
  • Loading branch information
fabianbormann authored Mar 4, 2024
2 parents 0d46709 + 3c45a5b commit 5e2e2d1
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 6 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 📊 Run Plot Action and Upload Results
name: 📊 Generate Report and 📦 Publish to Maven Central

on:
push:
Expand All @@ -8,7 +8,30 @@ on:
workflow_dispatch:

jobs:
plot-and-publish:
publish-to-maven-central:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v3

- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: 📦 Publish package
run: "./mvnw clean deploy --batch-mode -DskipTests -Pci-cd -pl calculation"
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
create-report:
runs-on: ubuntu-latest
if: "github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, 'release-please--branches--main')"
steps:
Expand Down
90 changes: 88 additions & 2 deletions calculation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.cardanofoundation</groupId>
<artifactId>cf-rewards</artifactId>
<version>0.6.2</version>
<version>0.6.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -28,7 +28,93 @@
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>

<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${version.maven-gpg-plugin}</version>
<type>maven-plugin</type>
</dependency>
</dependencies>

<profiles>
<profile>
<id>ci-cd</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- Prevent gpg from using pinentry programs. Fixes: gpg: signing
failed: Inappropriate ioctl for device -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${version.flatten-maven-plugin}</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${version.maven-site-plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${version.maven-project-info-reports-plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<scmCommentPrefix>[ci skip]</scmCommentPrefix>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>

</project>
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cardanofoundation</groupId>
<artifactId>cf-rewards</artifactId>
<version>0.6.2</version>
<version>0.6.3</version>
<name>cardano-reward-calculation</name>
<modules>
<module>calculation</module>
Expand Down Expand Up @@ -56,6 +56,10 @@
<version.hiberate-validator>8.0.1.Final</version.hiberate-validator>
<version.cardano-client-lib>0.4.3</version.cardano-client-lib>
<version.postgres>42.7.1</version.postgres>
<version.maven-site-plugin>4.0.0-M2</version.maven-site-plugin>
<version.maven-gpg-plugin>3.1.0</version.maven-gpg-plugin>
<version.flatten-maven-plugin>1.2.7</version.flatten-maven-plugin>
<version.maven-project-info-reports-plugin>3.3.0</version.maven-project-info-reports-plugin>
</properties>


Expand Down
2 changes: 1 addition & 1 deletion validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.cardanofoundation</groupId>
<artifactId>cf-rewards</artifactId>
<version>0.6.2</version>
<version>0.6.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit 5e2e2d1

Please sign in to comment.