name: Release Milestones

on:
  push:
    branches: [ release/milestone ]

jobs:
  build:
    name: Release project
    runs-on: ubuntu-latest

    steps:

    - name: Check out sources
      uses: actions/checkout@v4

    - name: Set up JDK 17
      uses: actions/setup-java@v3
      with:
        distribution: 'temurin'
        java-version: 17
        cache: 'maven'

    - name: Build with Maven
      run: ./mvnw -B

    - name: Deploy to Artifactory
      env:
        ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
        ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
      run: ./mvnw -B clean deploy -Pci,artifactory

    - name: Setup Graphviz
      uses: ts-graphviz/setup-graphviz@v1

    - name: Deploy documentation
      env:
        ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
        ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
      run: ./mvnw -B clean deploy -Pdocumentation
