Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions build - deploy snap, java 8 11 14 #3631

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/maven-pulls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 14 ]

steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven and Gradle
run: |
./mvnw -B install --file pom.xml
cd ./modules/swagger-gradle-plugin
./gradlew build --info
cd ../..
27 changes: 21 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ name: Java CI with Maven

on:
push:
branches: [ master, "1.5" ]
pull_request:
branches: [ master, "1.5" ]
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [ 8, 12 ]
java: [ 8, 11, 14 ]

steps:
- uses: actions/checkout@v2
Expand All @@ -31,9 +28,27 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven and Gradle
- name: Build with Maven and Gradle, Deploy snapshot to maven central
run: |
./mvnw -B install --file pom.xml
cd ./modules/swagger-gradle-plugin
./gradlew build --info
cd ../..
export MY_JAVA_VERSION=`java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1`
echo "JAVA VERSION" ${MY_JAVA_VERSION}
if [[ ${MY_JAVA_VERSION} == "8" ]];
then
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
./mvnw -B deploy
else
echo "not deploying release: " ${MY_POM_VERSION}
fi
else
echo "not deploying on java version: " ${MY_JAVA_VERSION}
fi
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}