name: Main
on:
  pull_request:
  push:
    branches:
      - main

jobs:
  checks:
    runs-on: macOS-latest
    steps:

      - name: Project Checkout
        uses: actions/checkout@v2

      - name: Setup JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Build project
        run: ./gradlew build --stacktrace

      - name: Assemble Test APK
        run: ./gradlew assembleAndroidTest --stacktrace

      - name: Espresso Checks
        uses: reactivecircus/android-emulator-runner@v2.14.3
        with:
          api-level: 16
          script: ./gradlew leakcanary-android-core:connectedCheck leakcanary-android-instrumentation:connectedCheck --stacktrace

  snapshot-deployment:
    if: "github.event_name == 'push'"
    needs: [checks]
    runs-on: ubuntu-latest
    steps:

      - name: Project Checkout
        uses: actions/checkout@v2

      - name: Setup JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Deploy snapshot
        run: ./gradlew uploadArchives
        env:
          ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
          ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}

      - name: Cleanup secrets
        if: always()
        run: rm -rf ~/.gradle/gradle.properties

name: Main
on:
  pull_request:
  push:
    branches:
      - main

jobs:
  checks:
    runs-on: macos-latest
    steps:

      - name: Project Checkout
        uses: actions/checkout@v2

      - name: Setup JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Build project
        run: ./gradlew build --stacktrace

      - name: Assemble Test APK
        run: ./gradlew assembleAndroidTest --stacktrace

      - name: Espresso Checks
        uses: reactivecircus/android-emulator-runner@v2.14.3
        with:
          api-level: 16
          script: ./gradlew leakcanary-android-core:connectedCheck leakcanary-android-instrumentation:connectedCheck --stacktrace

  snapshot-deployment:
    if: "github.event_name == 'push'"
    needs: [checks]
    runs-on: ubuntu-latest
    steps:

      - name: Project Checkout
        uses: actions/checkout@v2

      - name: Setup JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Deploy snapshot
        run: ./gradlew uploadArchives
        env:
          ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
          ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}

      - name: Cleanup secrets
        if: always()
        run: rm -rf ~/.gradle/gradle.properties

Fix "Schema validation: String violates the pattern: '^\$\{\{.*\}\}$' "
Fix "Schema validation: String violates the pattern: '^\$\{\{.*\}\}$' "
