From f73cb5f2083ee5a8d4ee671604e97ce58812d540 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 13 Jun 2016 01:58:06 -0700 Subject: drone 0.5 --- .drone.yml | 25 +++++++++++++++---------- .drone/authenv.sh | 23 +++++++++++++---------- project/plugins.sbt | 2 -- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9d88541..fd43197 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,19 +1,24 @@ -build: - unit_tests: - image: jodersky/ci:0.2 +pipeline: + build: + image: jodersky/ci commands: - sbt +test publish: - image: jodersky/ci:0.2 + image: jodersky/ci when: event: tag - success: true + status: success environment: - SECURE: "$$SECURE" - GPG_SSB_ENC: "$$GPG_SSB_ENC" - BINTRAY_KEY: "$$BINTRAY_KEY" + GPG_ID: 0xBEDDC1EFEE0D53FE6F853B0D71C38F1DB2C92742 + #GPG_KEY: "$$GPG_KEY" + # Although the key is already encrypted in drone, giving it a password + # makes it easier to handle outside of drone. E.g. gpg2 has issues + # with password-less keys https://bugs.gnupg.org/gnupg/issue2070 + #GPG_PASSWORD: "$$GPG_PASSWORD" + #SONATYPE_USERNAME: "$$SONATYPE_USERNAME" + #SONATYPE_PASSWORD: "$$SONATYPE_PASSWORD" commands: - - .drone/authenv.sh + - echo "$GPG_KEY" | base64 -w 0 -d | gpg --batch --import - sbt +publishSigned - - exho "done" + - echo "Done" diff --git a/.drone/authenv.sh b/.drone/authenv.sh index ba9bc01..7dbeaaa 100755 --- a/.drone/authenv.sh +++ b/.drone/authenv.sh @@ -1,17 +1,19 @@ -#!/bin/sh +#!/bin/bash + +# Set up an environment for signing and publishing sbt projects. -# Set up the environment for signing and publishing sbt projects. # WARNING: this script has global side effects, it is intended to be # run in an isolated, throw-away environment! set -e +set -o pipefail -echo "Preparing authenticated environment" +echo "Preparing authenticated environment" >&2 -# Veridy that this script is running in a CI environment and has +# Verify that this script is running in a CI environment and has # secrets available if [ -z "CI" ]; then - echo "This script should be run in a CI environment. Aborting." + echo "This script should be run in a CI environment. Aborting." >&2 exit 1 fi if [ -z "$SECURE" ] || [ "$SECURE" = "\$\$SECURE" ]; then @@ -19,20 +21,21 @@ if [ -z "$SECURE" ] || [ "$SECURE" = "\$\$SECURE" ]; then exit 1 fi -# Import secret signing sub key. +# Import gpg signing (secret) key. # -# Although the key is encrypted as a drone secret, it must also be +# Although the key is encrypted as a drone secret, it should also be # encrypted with a passphrase since gpg2 does not allow exporting keys # with empty passwords https://bugs.gnupg.org/gnupg/issue2070 -echo "$GPG_SSB_ENC" | base64 -w 0 -d | gpg --batch --import -echo "Imported signing key" +# The used password is 0000000000 +echo "$GPG_KEY_ENC" | base64 -w 0 -d | gpg --batch --import +echo "Imported signing key" >&2 # Prepare gpg settings for sbt cat << EOF > "gpg.sbt" pgpSigningKey in Global := Some(0x2CED17AB2B6D6F37l) pgpPassphrase in Global := Some("0000000000".toCharArray) EOF -echo "sbt-pgp ready" +echo "sbt-pgp ready" >&2 # Prepare bintray settings mkdir -p "$HOME/.bintray" diff --git a/project/plugins.sbt b/project/plugins.sbt index e1536eb..4ce4d9e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") - -addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") -- cgit v1.2.3