image: registry.gitlab.com/hardysim/android-ci:latest

cache:
  paths:
  - .gradle/wrapper
  - .gradle/caches
  - .android/build-cache/

stages:
- build
- release

before_script:
- export GRADLE_USER_HOME=.gradle
- export ANDROID_SDK_HOME=$CI_PROJECT_DIR
- chmod +x ./gradlew

debug build:
  stage: build
  tags:
    - docker
  script:
    - ./gradlew assembleDebug
  except:
    - master

library release build:
  stage: build
  tags:
    - docker
  script:
    - ./gradlew clean library:assembleRelease androidSourcesJar
  artifacts:
    paths:
      - library/build*
  only:
    - master

#library upload to Bintray:
#  stage: release
#  tags:
#    - docker
#  script:
#    - ./gradlew generatePomFileForReleasePublication bintrayUpload
#  dependencies:
#    - library release build
#  only:
#    - master
#  when: manual

library upload to MavenCentral:
  stage: release
  tags:
    - docker
  before_script:
    - echo $GPG_KEY_CONTENTS > secret.gpg
  script:
    - ./gradlew library:uploadArchives
  dependencies:
    - library release build
  only:
    - master
  when: manual

image: registry.gitlab.com/hardysim/android-ci:latest

cache:
  paths:
  - .gradle/wrapper
  - .gradle/caches
  - .android/build-cache/

stages:
- build
- release

before_script:
- export GRADLE_USER_HOME=.gradle
- export ANDROID_SDK_HOME=$CI_PROJECT_DIR
- chmod +x ./gradlew

debug build:
  stage: build
  tags:
    - docker
  script:
    - ./gradlew assembleDebug
  except:
    - master

library release build:
  stage: build
  tags:
    - docker
  script:
    - ./gradlew clean library:assembleRelease androidSourcesJar
  artifacts:
    paths:
      - library/build*
  only:
    - master

#library upload to Bintray:
#  stage: release
#  tags:
#    - docker
#  script:
#    - ./gradlew generatePomFileForReleasePublication bintrayUpload
#  dependencies:
#    - library release build
#  only:
#    - master
#  when: manual

library upload to MavenCentral:
  stage: release
  tags:
    - docker
  before_script:
    - echo $GPG_KEY_CONTENTS > secret.gpg
  script:
    - ./gradlew library:publishReleasePublicationToSonatypeRepository closeAndReleaseRepository
  dependencies:
    - library release build
  only:
    - master
  when: manual

Update GitLab CI script to use new publishing plugins
Update GitLab CI script to use new publishing plugins
