Skip to content

Commit

Permalink
Move package to org.dhatim and deploy with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Chédru committed Mar 20, 2021
1 parent 54b557b commit 9071eb1
Show file tree
Hide file tree
Showing 23 changed files with 306 additions and 199 deletions.
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>
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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 }}
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
else
# this is a regular build
mvn -ntp install
fi
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.classpath
.project
.settings/
/.idea/
hamcrest-postgresql.iml
79 changes: 63 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<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>

<groupId>com.dhatim</groupId>
<parent>
<groupId>org.dhatim</groupId>
<artifactId>root-oss</artifactId>
<version>21.2.0</version>
</parent>

<groupId>org.dhatim</groupId>
<artifactId>hamcrest-postgresql</artifactId>
<version>0.0.26-SNAPSHOT</version>
<version>0-SNAPSHOT</version>
<packaging>jar</packaging>

<prerequisites>
<maven>3.0</maven>
</prerequisites>

<name>Hamcrest-style matchers for Postgresql SQLs</name>
<url>https://github.com/dhatim/hamcrest-postgresql</url>

Expand All @@ -21,23 +23,20 @@
</licenses>

<scm>
<connection>scm:git:git@github.com:dhatim/hamcrest-postgresql.git</connection>
<connection>scm:git:https://github.com/dhatim/hamcrest-postgresql</connection>
<tag>HEAD</tag>
</scm>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler-plugin.version>3.3</compiler-plugin.version>
<antlr4.version>4.7</antlr4.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -48,7 +47,6 @@
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>${antlr4.version}</version>
</dependency>
</dependencies>

Expand All @@ -57,7 +55,6 @@
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr4.version}</version>
<executions>
<execution>
<id>antlr</id>
Expand All @@ -75,7 +72,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>add-sources</id>
Expand All @@ -91,12 +87,63 @@
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<show>public</show>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</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>
Loading

0 comments on commit 9071eb1

Please sign in to comment.