travis-sonatype-publish.sh 789 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/bash
# Publishes the latest snapshot to Sonatype. Works only for SNAPSHOT versions.
# Based closely on material from
# http://benlimmer.com/2014/01/04/automatically-publish-to-sonatype-with-gradle-and-travis-ci.

if [ "$TRAVIS_REPO_SLUG" == "bumptech/glide" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "3.0a" ]; then
  if [[ $(./gradlew -q getVersion) != *SNAPSHOT* ]]; then
      echo 'Travis can only publish snapshots.'
      return 0
  fi

  echo -e "Starting publish to Sonatype...\n"

S
Sam Judd 已提交
14
  ./gradlew uploadArchives -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}"
15 16 17 18 19 20 21 22 23 24 25
  RETVAL=$?

  if [ $RETVAL -eq 0 ]; then
    echo 'Completed publish!'
  else
    echo 'Publish failed.'
    return 1
  fi
else
    echo 'Skipping Sonatype push'
fi