Skip to content

Commit

Permalink
Build with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Chédru committed Dec 14, 2021
1 parent 073c733 commit 05199ae
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 241 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
20 changes: 20 additions & 0 deletions .github/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build
on:
push:
branches: [ '*' ]
tags: [ '*' ]
pull_request:
branches: [ '*' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: get tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: maven build
env:
TAG: ${{ steps.get_tag.outputs.tag }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
if echo "${TAG}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$'
then
# the tag looks like a version number: proceed with release
echo ${GPG_SECRET_KEY} | base64 --decode | gpg --import --no-tty --batch --yes
echo ${GPG_OWNERTRUST} | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes
mvn -ntp versions:set -DnewVersion=${TAG}
mvn -ntp -s .github/settings.xml -Prelease deploy jacoco:report coveralls:report -DrepoToken=${COVERALLS_TOKEN}
else
# this is a regular build
mvn -ntp install
fi
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target/
/target/
.idea/
17 changes: 0 additions & 17 deletions .rultor.yml

This file was deleted.

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

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![Build Status](https://travis-ci.org/dhatim/business-hours-java.svg?branch=master)](https://travis-ci.org/dhatim/business-hours-java)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.dhatim/business-hours/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.dhatim/business-hours)
[![Build Status](https://github.com/dhatim/business-hours-java/workflows/build/badge.svg)](https://github.com/dhatim/business-hours-java/actions)
[![Coverage Status](https://coveralls.io/repos/github/dhatim/business-hours-java/badge.svg?branch=master)](https://coveralls.io/github/dhatim/business-hours-java?branch=master)
[![Javadoc](https://www.javadoc.io/badge/org.dhatim/business-hours.svg)](http://www.javadoc.io/doc/org.dhatim/business-hours)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.dhatim/business-hours-java/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.dhatim/business-hours-java)
[![Javadocs](http://www.javadoc.io/badge/org.dhatim/business-hours-java.svg)](http://www.javadoc.io/doc/org.dhatim/business-hours-java)


<h1>business-hours-java</h1>

Expand Down
133 changes: 53 additions & 80 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.dhatim</groupId>
<artifactId>root-oss</artifactId>
<version>22.0.2</version>
</parent>
<groupId>org.dhatim</groupId>
<artifactId>business-hours</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>A library that helps dealing with business hours, such has "Monday through Friday from 9am to 6pm, and from 9am to 12pm on Saturdays".</description>
Expand All @@ -27,12 +32,6 @@
<developerConnection>scm:git:[email protected]:dhatim/business-hours-java.git</developerConnection>
<url>[email protected]:dhatim/business-hours-java.git</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
Expand All @@ -46,12 +45,12 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<goals>
Expand All @@ -63,44 +62,13 @@
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</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>2.10.4</version>
<configuration>
<show>public</show>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -110,44 +78,49 @@
</execution>
</executions>
</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>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
<configuration>
<server>github</server>
<message>Publish javadoc</message>
<outputDirectory>target/apidocs</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
41 changes: 0 additions & 41 deletions pubring.gpg.asc

This file was deleted.

Loading

0 comments on commit 05199ae

Please sign in to comment.