name: Publish Snapshot

on:
  push:
    branches: [ dev ]
  pull_request:
    branches: [ dev ]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          distribution: 'zulu'
          java-version: 17
          cache: 'maven'
          cache-dependency-path: 'pom.xml'
          server-id: oss
          server-username: MAVEN_USERNAME
          server-password: MAVEN_PASSWORD
      - name: Publish to the Maven Central Repository
        run: |
          mvn clean package deploy -P !develop
        env:
          MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
          MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
