steps:              
  restore-cache:
    image: plugins/cache
    settings:
      restore: true
      mount:
        - /root/.m2
        - frontend/node_modules
      path: /tmp/woodpecker-cache
    when:
      event: [push, pull_request, manual]
      
  backend-build:
    image: maven:3.9-eclipse-temurin-17
    commands:
      - echo "Building backend + frontend"
      - mvn clean install -Pprod -DskipTests
      - cp target/resilient*.jar /woodpecker/artifacts
    artifacts:
      - target/*.jar
    when:
      event: [push, pull_request, manual]
      branch:
        include:
          - main
          - master
          - develop

  save-cache:
    image: plugins/cache
    settings:
      rebuild: true
      mount:
        - /root/.m2
        - frontend/node_modules
      path: /tmp/woodpecker-cache
    when:
      event: [push, pull_request, manual]