name: upload-snapshot

on:
  push:
    branches: [ develop ]

jobs:
  upload:
    runs-on: ubuntu-latest

    steps:
      - name: Repository checkout
        uses: actions/checkout@v3
      - name: JDK setup
        uses: actions/setup-java@v3
        with:
          java-version: 8
          distribution: temurin
      - name: Gradle setup
        uses: gradle/gradle-build-action@v2
      - name: Tests
        run: ./gradlew check
        env:
          TEST_PROFILE: ci
      - name: Upload snapshot to Maven Central
        run: ./gradlew build uploadSnapshot -x dokkaHtml
        env:
          ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ossrhUsername }}
          ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ossrhPassword }}
