Merge pull request #1 from icrc/add-github-actions #2
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
name: Build with Maven | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: [ ubuntu-latest ] | |
java-version: [ 8 ] | |
runs-on: ${{ matrix.platform }} | |
permissions: | |
contents: read | |
packages: write | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
JAVA_VERSION: ${{ matrix.java-version }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java-version }} | |
- 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: Install dependencies | |
run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode --show-version --file pom.xml | |
- name: Build with Maven | |
run: mvn test --batch-mode --file pom.xml | |
- name: Publish package | |
if: ${{ github.event_name == 'push' }} | |
run: mvn --batch-mode deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |