sbt / sbt-ci-release

sbt plugin to automate Sonatype releases from GitHub Actions
Apache License 2.0
286 stars 76 forks source link

Add gpg 2 support #163

Closed eed3si9n closed 3 years ago

eed3si9n commented 3 years ago

Fixes #95 Ref https://github.com/sbt/sbt-pgp/pull/184 Ref https://dev.gnupg.org/T2313

This parses the gpg version number and uses --batch --import to import the secret key.

This should fix the mysterious error message we see on GitHub Actions:

error sending to agent: Inappropriate ioctl for device

I have not tested this, but I have a similar workaround as Bash script (https://github.com/sbt/sbt-projectmatrix/blob/7781c86aea159c90bd55d549eede41c65cb4e140/.github/decodekey.sh), which is able to auto publish using sbt-ci-release without downgrading to gpg 1.4.

eed3si9n commented 3 years ago

I guess you could make M1? or I could do it under some other org if I get around to it.

olafurpg commented 3 years ago

The v1.5.5 release completed and is available to download from Maven Central

soronpo commented 3 years ago

Is this supposed to work? I'm getting


[info] gpg: no default secret key: secret key not available
[info] gpg: signing failed: secret key not available
[error] java.lang.RuntimeException: Failure running 'gpg --batch --passphrase *** --detach-sign --armor --use-agent --output /home/runner/work/DFiant/DFiant/modLibs/continuum/target/scala-2.13/continuum_2.13-0.1.1.pom.asc /home/runner/work/DFiant/DFiant/modLibs/continuum/target/scala-2.13/continuum_2.13-0.1.1.pom'.  Exit code: 2
[```

Is it unrelated? The snapshots are OK.
eed3si9n commented 3 years ago

@soronpo A successful run using sbt-ci-release 1.5.5 would look something like this:

Running ci-release.
  branch=refs/tags/v0.15.1
gpg (GnuPG) 2.2.19
gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key 2C1ED688D2DF767E: public key "expecty bot <eed3si9n@gmail.com>" imported
Tag push detected, publishing a stable release
gpg: key 2C1ED688D2DF767E: secret key imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
gpg:   secret keys imported: 1
[info] Defining Global / pgpSecretRing
[info] The new value will be used by Global / pgpStaticContext
[info] Reapplying settings...
[info] set current project to Expecty Root (in build file:/home/runner/work/expecty/expecty/)
[info] Defining Global / pgpPublicRing
[info] The new value will be used by Global / pgpStaticContext
[info] Reapplying settings...
....
[info]  published expecty_2.12 to /home/runner/work/expecty/expecty/target/sonatype-staging/0.15.1/com/eed3si9n/expecty/expecty_2.12/0.15.1/expecty_2.12-0.15.1.jar.asc
....

Are you using GitHub Actions?

soronpo commented 3 years ago

Are you using GitHub Actions?

Yes, but I had it working several months ago with Travis, I looked again at the run, and it actually uses GPG 1.4. I opened a separate issue. https://github.com/olafurpg/sbt-ci-release/issues/172

If I didn't enter the proper keys, will the same error be presented or a different one?