name: Maven Snapshot Release Workflow
on: workflow_dispatch

jobs:
  deploy:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3

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

      - name: Set up settings.xml
        run: echo "<settings><servers><server><id>github</id><username>${{ github.repository_owner }}</username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>" > /home/runner/.m2/settings.xml

      - name: Maven Deploy
        if: github.ref == 'refs/heads/main'
        run: mvn deploy --batch-mode -Pprod -Psql -DskipTests -Pgithub --settings /home/runner/.m2/settings.xml
