Skip to content

Commit

Permalink
Merge 6742d49 into e08dbe0
Browse files Browse the repository at this point in the history
  • Loading branch information
Clayton7510 committed Sep 11, 2020
2 parents e08dbe0 + 6742d49 commit 0b11b06
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 30 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/cd.yml
@@ -0,0 +1,72 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CD with Maven

on:
push:
branches: [ develop, master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up Maven
env:
GPG_KEY: ${{ secrets.MAVEN_KEY }}
run: |
export GPG_TTY=$(tty)
cp .mvn.settings.xml $HOME/.m2/settings.xml
echo "$GPG_KEY" >> codesigning.asc
gpg --batch --import codesigning.asc
shred --remove codesigning.asc
- name: Set up Terraform
run: |
curl -g https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip -o /tmp/terraform.zip
sudo unzip /tmp/terraform.zip -d /usr/bin
- name: Build with Maven
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
cd tf-build-tools
./mvnw clean test coveralls:report -DrepoToken="$COVERALLS_REPO_TOKEN" -Dbranch="$BRANCH_NAME"
cd ..
- name: Deploy
id: deploy
env:
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PW }}
GPG_KEY_PW: ${{ secrets.MAVEN_KEY_PW }}
GPG_KEY_ID: ${{ secrets.MAVEN_KEY_ID }}
run: |
cd tf-build-tools
VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)
PROFILE="SNAPSHOT"
if ! echo $VERSION | grep -q SNAPSHOT ; then
PROFILE="release"
if [ "${BRANCH_NAME}" == "develop" ] ; then
# Ensure that the build number is in the 4th [semver] position
DOTS=$VERSION | sed -e 's/\(.\)/\n/g' | grep l | wc -l
if [ $DOTS -lt 3 ]; then
VERSION="${VERSION}.0"
fi
VERSION="${VERSION}-${GITHUB_RUN_NUMBER}"
echo "***** VERSION has been updated to $VERSION ******"
./mvnw versions:set -DnewVersion="${VERSION}"
fi
fi
# Stage for Maven Central Deployment
export GPG_TTY=$(tty)
./mvnw deploy -DskipTests=true -P ${PROFILE} -pl !"tf-test"
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,30 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
pull_request:
branches: [ develop, master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Setup Terraform
run: |
curl -g https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip -o /tmp/terraform.zip
sudo unzip /tmp/terraform.zip -d /usr/bin
- name: Build with Maven
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
cp .mvn.settings.xml $HOME/.m2/settings.xml
cd tf-build-tools && ./mvnw clean test coveralls:report -DrepoToken="$COVERALLS_REPO_TOKEN" -Dbranch="$BRANCH_NAME"
13 changes: 13 additions & 0 deletions .mvn.settings.xml
Expand Up @@ -9,4 +9,17 @@
<pluginGroups>
<pluginGroup>org.eluder.coveralls</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEY_ID}</gpg.keyname>
<gpg.passphrase>${env.GPG_KEY_PW}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
24 changes: 2 additions & 22 deletions .travis.yml
@@ -1,33 +1,13 @@
language: java
env:
global:
- secure: STW9FkS69BRtMGlF+BGJEefaHi1UzguzkyQOZZxKZp93bJTzWafGLonwDW/Aky3BhlRwCfKrl9e0BuF+j1ACBv5gxowvO8RuwFzBNbpKOeTAtVEmqXrqfLtfN+w3tKj41Db08NxP9NNlxQst9FSlhJP0EM1EdetcMTYwMWvL2Q71UP2RD3vziorPON6W+hiXA1pstRHkYc3G5x7dmVvP6nMcUo/vPvbPi6QOn4SS2Pm/f9t5vAA1UYsXgfQDXG178wI9WMpiUo75hCHL2yzYnLszigWEzG2UDkAM35vJnLwI/fGhl4jysf8r85+bDusfkJ7TYQizRChLpfdOO67UwDTGAN28/KEvhSXT8TG6lMLu35xk3kRvN6mjcnYtxWYhaJjuXQ23vrdXfZvsoXbaW7DwPafqsG8nvhjMUXnXHmNUV+K4RIEqrnYmapxPTVAEmWluzyfCCEptpwpb0Xl2fc/KVy02o63a8rKaa2CaepZt6b7juFVTXeWYmaJ66NoHovXYtbGpiC2v1iDa8bmrdRkb1GzQ/PEcUTToGOeTOEkOZbvCMt2xS2B/cvgo3w2Z4C8moovY2dDjOP5F94fwBwbwodK/b5f8QBPwECqZIoQpqhvtMo99HOQJgpPhKLddUqhzw1rjPt07S2QDiHkwd4EePeZ6ZIcY61iGtMcwpes=
- secure: mesHrCi3fqaM538dEQJftOarOTEAMgo61uFx0RmOvg3nBVJphaLHoJWaYXfA5qtNhXTSYFwAeqIxAywRljEspRVwvhXvykRuGUzgk1w5MIL8OLflK34SU7m/eBPGVw6Ka4Uft8vnnZYzfl1qEY05EP9M20gciAujmfSnzSjfyIM9hZieDlsz4YkPexnuV9t7cFWEipg4icac6n0NFcZxzznnQ7Tyg+GyJA3HCVgB4jpfIPByJumpGBla1hFkfcWsgyL2uzQozcWUqLzW772PiPc6H75AAGSIDC63dwA3rmzCfBdj1POwn1mezRoJrxt0c3vr1uoSztZe5wquGEoUw1QRxOyEiYWy0z+TFWfb5G5D/H+7ICllL4+PXqI3Mf5uyujI3JNxeTbOa+lkydx79kL+ulOy2AyrY6IMmzRsyGmRxhpdoreQwHFKIsydqxEtBXHZ3oCcjR83hxLF9atbefWq8CNfvdLYsUUxwsUSmF+IBo5se/kJ7zwdb9yFWX2NzlJhchDmU97dXIzdn8PI4mFC0p/gmllJvr/cdjSBxLxgPVcH8fQ0kH6oMgNEXKvl1od/Qls95w0nP4W33zYxEk+DCKwdCXIQ8arEj4lamSEGyzii0zdn1gM/LExyu/SQ8ZOeWTEOLHuWYMNj7zuEVmaf1b1wwZf8a5E8hH4W6RA=
sudo: false
branches:
only:
- develop
- /^release\/v.*$/
- /^hotfix\/v.*$/
- none
cache:
directories:
- $HOME/.m2
jdk:
- openjdk8
before_install:
- curl -g https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip -o /tmp/terraform.zip
- sudo unzip /tmp/terraform.zip -d /usr/bin
script:
- |
cd tf-build-tools
echo "*** Downloading the help plugin and getting the project version ***"
./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [ $TRAVIS_PULL_REQUEST = "false" ] && echo $VERSION | grep -q SNAPSHOT; then
echo "*** Validating the build and deploying to Sonatype's SNAPSHOT repo ***"
cp ../.mvn.settings.xml $HOME/.m2/settings.xml && ./mvnw clean test coveralls:report deploy
else
echo "*** Validating the build ***"
./mvnw clean test coveralls:report
fi
"***** Travis No More! *****"
14 changes: 7 additions & 7 deletions README.md
@@ -1,10 +1,10 @@
[tf-maven-plugin]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-maven-plugin/0.11/maven-plugin
[tf-cmd-api]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-cmd-api/0.11/jar
[tf-s3-archetype]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-s3-archetype/0.11/jar
[tf-maven-plugin]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-maven-plugin/0.11.1/maven-plugin
[tf-cmd-api]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-cmd-api/0.11.1/jar
[tf-s3-archetype]:https://search.maven.org/artifact/com.deliveredtechnologies/tf-s3-archetype/0.11.1/jar
[tf-maven-plugin-snapshot]:https://oss.sonatype.org/content/repositories/snapshots/com/deliveredtechnologies/tf-maven-plugin/
[tf-cmd-api-snapshot]:https://oss.sonatype.org/content/repositories/snapshots/com/deliveredtechnologies/tf-cmd-api/
[tf-s3-archetype-snapshot]:https://oss.sonatype.org/content/repositories/snapshots/com/deliveredtechnologies/tf-s3-archetype/
[maven-badge]:https://img.shields.io/badge/maven%20central-0.11-green.svg
[maven-badge]:https://img.shields.io/badge/maven%20central-0.11.1-green.svg
[maven-snapshot-badge]:https://img.shields.io/badge/SNAPSHOT-0.12-green.svg

![terraform-maven](.docs/MavenTerraform.png)
Expand All @@ -13,7 +13,7 @@


![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)
[![Build Status](https://travis-ci.org/deliveredtechnologies/terraform-maven.svg?branch=develop&maxAge=600&service=github)](https://travis-ci.org/deliveredtechnologies/terraform-maven)
[![Build Status](https://github.com/deliveredtechnologies/terraform-maven/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/deliveredtechnologies/terraform-maven/actions?query=workflow%3A%22Java+CI+with+Maven%22)
[![Coverage Status](https://coveralls.io/repos/github/deliveredtechnologies/terraform-maven/badge.svg?branch=develop)](https://coveralls.io/github/deliveredtechnologies/terraform-maven?branch=develop)
[![Maven Central][maven-badge]][tf-maven-plugin]

Expand Down Expand Up @@ -303,15 +303,15 @@ Instead of doing all the above steps you can simply build the module/project by
An example on how to generate the project using an archetype is shown below.

```bash
mvn archetype:generate -B -DarchetypeGroupId=com.deliveredtechnologies -DarchetypeArtifactId="tf-s3-archetype" -DarchetypeVersion=0.10 -DgroupId=<custom_group_name> -DartifactId=<custom-artifact_name>
mvn archetype:generate -B -DarchetypeGroupId=com.deliveredtechnologies -DarchetypeArtifactId="tf-s3-archetype" -DarchetypeVersion=0.11 -DgroupId=<custom_group_name> -DartifactId=<custom-artifact_name>
```

Maven Non-Interactive mode creates a project with the name that you passed in <custom_articatId_name> under <custom_groupId_name>.

or

```bash
mvn archetype:generate -DarchetypeGroupId=com.deliveredtechnologies -DarchetypeArtifactId="tf-s3-archetype" -DarchetypeVersion=0.10
mvn archetype:generate -DarchetypeGroupId=com.deliveredtechnologies -DarchetypeArtifactId="tf-s3-archetype" -DarchetypeVersion=0.11
```

After running the above command mvn interactive console prompts for the required arguments (ex: groupId and artifactId) and creates the project accordingly.
Expand Down
1 change: 0 additions & 1 deletion tf-build-tools/.coveralls.yml

This file was deleted.

6 changes: 6 additions & 0 deletions tf-build-tools/pom.xml
Expand Up @@ -136,6 +136,12 @@
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
Expand Down

0 comments on commit 0b11b06

Please sign in to comment.