title: sbt publishSigned on Sonatype Nexus via Travis CI with using pgpPassphrase
body: <p>I've build an OSS project <a href="https://github.com/datlinq/scalafiniti" rel="nofollow noreferrer">https://github.com/datlinq/scalafiniti</a> 
  The <a href="https://travis-ci.org/datlinq/scalafiniti" rel="nofollow noreferrer">Travis-ci</a> pipeline works perfectly, but for 1 final step.</p>
  
  <p>I followed these guides:</p>
  
  <ul>
  <li><a href="http://www.scala-sbt.org/0.13/docs/Using-Sonatype.html" rel="nofollow noreferrer">http://www.scala-sbt.org/0.13/docs/Using-Sonatype.html</a></li>
  <li><a href="http://www.scala-sbt.org/sbt-pgp/usage.html" rel="nofollow noreferrer">http://www.scala-sbt.org/sbt-pgp/usage.html</a></li>
  <li><a href="https://github.com/xerial/sbt-sonatype" rel="nofollow noreferrer">https://github.com/xerial/sbt-sonatype</a></li>
  </ul>
  
  <p>Locally I got all steps working fine and actually published to the Nexus.</p>
  
  <p>In the <code>.travis.yml</code> I import the key before install (Encrypted in travis.ci env)</p>
  
  <pre class="lang-yaml prettyprint-override"><code>before_install:
   - echo "$PGP_SECRET" | base64 --decode | gpg --import
   - echo "$PGP_TRUST" | base64 --decode | gpg --import-ownertrust
  </code></pre>
  
  <p>The <code>$PGP_PASS</code> is also encrypted in Travis env and available for the <code>build.sbt</code></p>
  
  <p>I checked it actually gets the key in this command</p>
  
  <pre class="lang-scala prettyprint-override"><code>pgpPassphrase := sys.env.get("PGP_PASS").map(_.toArray)
  </code></pre>
  
  <p>Now if Travis runs the command </p>
  
  <p><code>sbt publishSigned</code></p>
  
  <p>It still prompts for a passphrase for my key</p>
  
  <blockquote>
    <p>You need a passphrase to unlock the secret key for user:
    "com.datlinq.datalabs (Key for Datalabs OSS) "
    2048-bit RSA key, ID 305DA15D, created 2017-09-01 </p>
    
    <p>Enter passphrase:</p>
  </blockquote>
  
  <p>I don't know what I should do to make this work</p>
  
  <p>This moment in time is captured:</p>
  
  <p>code:
  <a href="https://github.com/datlinq/scalafiniti/tree/0d8a6a92bf111bae2a1081b17005a649f8fd00c9" rel="nofollow noreferrer">https://github.com/datlinq/scalafiniti/tree/0d8a6a92bf111bae2a1081b17005a649f8fd00c9</a>
  build log: 
  <a href="https://travis-ci.org/datlinq/scalafiniti/builds/271328874" rel="nofollow noreferrer">https://travis-ci.org/datlinq/scalafiniti/builds/271328874</a></p>