language: java
os: linux
dist: trusty

# don't build on tag push
if: tag IS blank

git:
  depth: false

before_install:
  - chmod +x gradlew

# override install to skip 'gradle assemble'
install: true

env:
  global:
    - TERM=dumb
    - JADX_LAST_TAG=$(git describe --abbrev=0 --tags)
    - JADX_VERSION="${JADX_LAST_TAG:1}-b$TRAVIS_BUILD_NUMBER-$(git rev-parse --short HEAD)"

jdk:
  - openjdk8
  - openjdk11

script: ./gradlew clean build

jobs:
  include:
    - stage: checks
      jdk: openjdk11
      if: branch = master AND repo = env(MAIN_REPO) AND type = push
      script: bash scripts/travis-checks.sh

    - stage: deploy-unstable
      jdk: openjdk8
      if: branch = master AND repo = env(MAIN_REPO) AND type = push
      script: bash scripts/travis-master.sh

    - stage: deploy-release
      language: node_js
      jdk: openjdk8
      node_js: 11
      if: branch = release AND repo = env(MAIN_REPO) AND type = push
      script: bash scripts/travis-release.sh
