Skip to content

Maven

Maven #86

Workflow file for this run

# Builds using maven
# Pass the arguments you wish to run to maven_commands variable, default command will be mvn install
---
name: Maven
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'
jobs:
build:
strategy:
matrix:
java: [8, 11]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
maven_commands: install # default is install
upload_artifact: true
artifact_dir: target/*.jar
artifact_dir_zip: target/*.zip
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
cache: 'maven'
- name: Build
run: mvn ${{ env.maven_commands }}
- name: Upload artifacts
if: matrix.os == 'ubuntu-latest' && matrix.java == '8' && env.upload_artifact == 'true'
uses: actions/upload-artifact@v2
with:
name: artifacts
if-no-files-found: error
retention-days: 1
path: |
${{ env.artifact_dir }}
${{ env.artifact_dir_zip }}
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags')
strategy:
matrix:
publishing_target: [github]
steps:
- name: Download artifacts from build
uses: actions/download-artifact@v2
- name: List artifacts
run: ls -R
- name: Upload binaries to release
if: ${{ matrix.publishing_target }} == 'github'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true