Merge pull request #2336 from ligangty/master #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Merge / Push Build | |
on: [push] | |
jobs: | |
build-on-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up cache for ~./m2/repository | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
maven- | |
- name: Install Toolchain JDK 1.8 | |
if: ${{ !contains(github.base_ref, 'maint') }} | |
uses: battila7/jdk-via-jabba@v1 | |
with: | |
jdk: '[email protected]' | |
addBinDirectoryToPath: false | |
javaHomeEnvironmentVariable: J8_TOOLCHAIN_JDK | |
- name: Install Toolchain JDK 11 | |
if: ${{ !contains(github.base_ref, 'maint') }} | |
uses: battila7/jdk-via-jabba@v1 | |
with: | |
jdk: '[email protected]' | |
addBinDirectoryToPath: false | |
javaHomeEnvironmentVariable: J11_TOOLCHAIN_JDK | |
- name: Set up Toolchain | |
if: ${{ !contains(github.base_ref, 'maint') }} | |
shell: bash | |
run: | | |
mkdir -p $HOME/.m2 \ | |
&& cat << EOF > $HOME/.m2/toolchains.xml | |
<?xml version="1.0" encoding="UTF8"?> | |
<toolchains> | |
<toolchain> | |
<type>jdk</type> | |
<provides> | |
<version>1.8</version> | |
<vendor>OpenJDK</vendor> | |
</provides> | |
<configuration> | |
<jdkHome>${{ env.J8_TOOLCHAIN_JDK }}</jdkHome> | |
</configuration> | |
</toolchain> | |
<toolchain> | |
<type>jdk</type> | |
<provides> | |
<version>11</version> | |
<vendor>OpenJDK</vendor> | |
</provides> | |
<configuration> | |
<jdkHome>${{ env.J11_TOOLCHAIN_JDK }}</jdkHome> | |
</configuration> | |
</toolchain> | |
</toolchains> | |
EOF | |
- name: Set up JDK | |
if: ${{ contains(github.base_ref, 'maint') }} | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Set up JDK | |
if: ${{ !contains(github.base_ref, 'maint') }} | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: maven-settings-xml-action | |
uses: whelk-io/maven-settings-xml-action@v14 | |
if: ${{ github.event.repository.fork == false }} | |
with: | |
repositories: '[{ "id": "sonatype", "url": "https://oss.sonatype.org/content/repositories/snapshots/", "releases": {"enabled": "false"}, "snapshots": {"enabled": "true" }}]' | |
servers: '[{ "id": "sonatype", "username": "${{ secrets.SONATYPE_BOT_USERNAME}}", "password": "${{ secrets.SONATYPE_BOT_TOKEN}}" }]' | |
- name: "Maven Build" | |
run: mvn -B -e -Prun-its,no-cluster-tests verify |