Skip to content

Commit

Permalink
Add github actions ci-cd
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaaano committed Sep 5, 2021
1 parent f8f0ed2 commit e3e905d
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 31 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ci-cd

on:
push:
branches: [master]
tags: [1.*]
paths:
- ".github/workflows/ci-cd.yml"
- "src/**"
- "pom.xml"
# pull_request:
# branches: [master]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: "15 1 * * *"

permissions:
contents: write

concurrency:
group: ci-cd
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-latest
env:
MVN: mvn --show-version --batch-mode
steps:
- name: jdk11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
server-id: ossrh
server-username: OSSRH_USR
server-password: OSSRH_PWD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: checkout
uses: actions/checkout@v2
- name: cache ~/.m2
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- name: version set
if: startsWith(github.ref, 'refs/tags/')
run: $MVN versions:set -DnewVersion=${GITHUB_REF#refs/tags/}
- name: mvn clean compile
run: $MVN clean compile
- name: mvn test
run: $MVN test
- name: mvn deploy
run: $MVN --activate-profiles deploy --define gpg.passphrase=${{ secrets.GPG_PASSPHRASE }} --define skipTests deploy
env:
OSSRH_USR: ${{ secrets.OSSRH_USR }}
OSSRH_PWD: ${{ secrets.OSSRH_PWD }}
- name: mvn release
if: startsWith(github.ref, 'refs/tags/')
run: $MVN --activate-profiles deploy nexus-staging:release
env:
OSSRH_USR: ${{ secrets.OSSRH_USR }}
OSSRH_PWD: ${{ secrets.OSSRH_PWD }}
- name: github release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/payload-*.jar
target/payload-*.jar.asc
# - name: Step To run on failure
# if: ${{ failure() }}
# run: $MVN --activate-profiles deploy nexus-staging:drop
# env:
# OSSRH_USR: ${{ secrets.OSSRH_USR }}
# OSSRH_PWD: ${{ secrets.OSSRH_PWD }}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ script:

after_success:
- if [[ -n "$TRAVIS_TAG" && "$TRAVIS_JDK_VERSION" == "openjdk11" ]]; then
$MAVEN_CMD nexus-staging:release --settings settings.xml;
$MAVEN_CMD nexus-staging:release --activate-profiles deploy --settings settings.xml;
fi

after_failure:
- if [[ -n "$TRAVIS_TAG" && "$TRAVIS_JDK_VERSION" == "openjdk11" ]]; then
$MAVEN_CMD nexus-staging:drop --settings settings.xml;
$MAVEN_CMD nexus-staging:drop --activate-profiles deploy --settings settings.xml;
fi

deploy:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Payload
[![Build Status](https://travis-ci.com/juliaaano/payload.svg)](https://travis-ci.com/juliaaano/payload)
[![ci](https://github.com/juliaaano/payload/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/juliaaano/payload/actions/workflows/ci-cd.yml)
[![Release](https://img.shields.io/github/release/juliaaano/payload.svg)](https://github.com/juliaaano/payload/releases/latest)
[![Maven Central](https://img.shields.io/maven-central/v/com.juliaaano/payload.svg)](https://maven-badges.herokuapp.com/maven-central/com.juliaaano/payload)
[![Javadocs](http://www.javadoc.io/badge/com.juliaaano/payload.svg?color=blue)](http://www.javadoc.io/doc/com.juliaaano/payload)
Expand Down Expand Up @@ -53,7 +53,7 @@ pre defined providers in the classpath. You can also [implement your own](#custo
<dependency>
<groupId>com.juliaaano</groupId>
<artifactId>payload</artifactId>
<version>1.1.1</version>
<version>1.1.3</version>
</dependency>
```

Expand Down
13 changes: 7 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?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">
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>

<groupId>com.juliaaano</groupId>
<artifactId>payload</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.1.4-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Payload</name>
Expand All @@ -16,15 +17,15 @@
<licenses>
<license>
<name>MIT License</name>
<url>http://www.juliaaano.com/LICENSE</url>
<url>https://www.juliaaano.com/LICENSE</url>
</license>
</licenses>

<developers>
<developer>
<name>Juliano Mohr</name>
<email>[email protected]</email>
<organization>Juliaaano</organization>
<organization>juliaaano</organization>
<organizationUrl>https://www.juliaaano.com</organizationUrl>
</developer>
</developers>
Expand Down Expand Up @@ -215,12 +216,12 @@
<goals>
<goal>sign</goal>
</goals>
<!-- <configuration>
<configuration>
<gpgArguments>
<arg>&#x002D;&#x002D;pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration> -->
</configuration>
</execution>
</executions>
</plugin>
Expand Down
11 changes: 0 additions & 11 deletions settings.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Thrown to indicate that a client has passed an invalid or unsupported
* {@link MediaType}.
*
* @author Juliano Mohr
* @author JM
*/
public class InvalidMediaTypeException extends IllegalArgumentException {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/juliaaano/payload/MediaType.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* type. Use it to retrieve {@link Payload} with the corresponding
* {@link PayloadFactory}.
*
* @author Juliano Mohr
* @author JM
*/
public enum MediaType {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/juliaaano/payload/Payload.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @param <T> the Java object type for which this payload is represented by.
*
* @author Juliano Mohr
* @author JM
*/
public interface Payload<T> {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/juliaaano/payload/PayloadFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* therefore implementations of this factory should be media type specific,
* such as {@link com.juliaaano.payload.xml.XmlProviderFactory}.
*
* @author Juliano Mohr
* @author JM
*/
public interface PayloadFactory {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/juliaaano/payload/provider/Provider.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* It should be extended by clients of the library who wish to support
* additional (custom) providers.
*
* @author Juliano Mohr
* @author JM
*/
public interface Provider {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* General internal exception to be thrown when there are Provider related
* issues.
*
* @author Juliano Mohr
* @author JM
*/
public class ProviderException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* listed in META-INF/services files, following {@link java.util.ServiceLoader}
* specification.
*
* @author Juliano Mohr
* @author JM
*/
public interface ProviderFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* META-INF/services files, as per specified in Java's
* {@link java.util.ServiceLoader}
*
* @author Juliano Mohr
* @author JM
*/
public interface ProviderStrategy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* This strategy enables custom mechanisms to supply provider factories
* through the {@link ProviderFactorySource}.
*
* @author Juliano Mohr
* @author JM
*/
public class SourcingProviderStrategy<T extends ProviderFactory> implements ProviderStrategy {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Source provider factories using {@link java.util.ServiceLoader} with
* implementations of {@link ProviderFactory}.
*
* @author Juliano Mohr
* @author JM
*/
public class SvcLoaderProviderFactorySource<T extends ProviderFactory> implements ProviderFactorySource<T> {

Expand Down

0 comments on commit e3e905d

Please sign in to comment.