Skip to content

Commit

Permalink
ci: migration from travis-ci to github actions
Browse files Browse the repository at this point in the history
 - github-actions: add workflows to publish snapshot/release versions on maven central repository.
 - remove configuration related to travis-ci.
  • Loading branch information
fgicquel committed Apr 6, 2023
1 parent d03a1d8 commit 6d91307
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 71 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/maven-publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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: Maven Publish Release

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3

- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
java-version: '8'
distribution: 'temurin'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import

- name: Set version from tag
run: |
echo $GITHUB_REF_NAME
mvn versions:set -DnewVersion=$GITHUB_REF_NAME
- name: Publish to Apache Maven Central
run: mvn -B --settings .m2/settings.xml clean deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
32 changes: 32 additions & 0 deletions .github/workflows/maven-publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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: Maven Publish Snapshot

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3

- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
java-version: '8'
distribution: 'temurin'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import

- name: Publish to Apache Maven Central
run: mvn -B --settings .m2/settings.xml clean deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Binary file removed .gnupg/pubring.gpg.enc
Binary file not shown.
Binary file removed .gnupg/secring.gpg.enc
Binary file not shown.
13 changes: 13 additions & 0 deletions .m2/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<settings>
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_TOKEN}</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
</server>
</servers>
</settings>
9 changes: 0 additions & 9 deletions .mvn/settings.xml

This file was deleted.

38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

43 changes: 19 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,6 @@
</dependencies>
</dependencyManagement>

<build>
<plugins>

</plugins>
</build>

<profiles>
<profile>
<id>coverage</id>
Expand Down Expand Up @@ -189,15 +183,10 @@
</build>
</profile>
<profile>
<id>travis</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
<gpg.defaultKeyring>false</gpg.defaultKeyring>
<gpg.publicKeyring>${env.TRAVIS_BUILD_DIR}/.gnupg/pubring.gpg</gpg.publicKeyring>
<gpg.secretKeyring>${env.TRAVIS_BUILD_DIR}/.gnupg/secring.gpg</gpg.secretKeyring>
</properties>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
Expand All @@ -216,6 +205,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -228,20 +218,27 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>true</skip>
</configuration>
Expand All @@ -265,18 +262,16 @@
<!-- explicit matching using the staging profile id -->
<!--stagingProfileId>7edbe315063867</stagingProfileId-->
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<stagingProgressTimeoutMinutes>15</stagingProgressTimeoutMinutes>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>

0 comments on commit 6d91307

Please sign in to comment.