Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github action mvn deploy #67

Closed
wants to merge 14 commits into from
33 changes: 33 additions & 0 deletions .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish package to the Maven Central Repository

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: 'temurin'
java-version: '11'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_SIGNING_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Publish to Apache Maven Central
run: mvn clean deploy -Dmaven.test.skip -Drevision=${{ github.event.release.tag_name }}
env:
MAVEN_USERNAME: ${{ secrets.MVN_CENTRAL_USERNAME}}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MVN_CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_KEY_PASSPHRASE }}
38 changes: 6 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>ct-conekta-java</artifactId>
<packaging>jar</packaging>
<name>ct-conekta-java</name>
<version>6.1.1</version>
<version>${revision}</version>
<url>https://developers.conekta.com/</url>
<description>This is a java library that allows interaction with https://api.conekta.io API.</description>
<scm>
Expand Down Expand Up @@ -34,10 +34,11 @@
</developers>

<distributionManagement>
<snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
Expand Down Expand Up @@ -185,10 +186,6 @@
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyname>0x5F8EB601</keyname>
<passphraseServerId />
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -259,30 +256,6 @@
</plugins>
</build>

<profiles>
<profile>
<id>sign-artifacts</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.json</groupId>
Expand Down Expand Up @@ -360,6 +333,7 @@
</dependency>
</dependencies>
<properties>
<revision>0.0.0-SNAPSHOT</revision>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey-version>2.37</jersey-version>
Expand Down
Loading