From b9de5a974df556fd3d8ddeaf2cc5c372a80f3401 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 29 Apr 2018 20:27:12 -0700 Subject: Set up travis and auto publish --- .ci/build | 46 ++++++++++++++++++++++++++++++++++++++++++++++ .ci/sec.gpg.enc | Bin 0 -> 3616 bytes .travis.yml | 23 +++++++++++++++++++++++ README.md | 8 ++++++++ project/publish.sbt | 2 ++ publish.sbt | 29 +++++++++++++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100755 .ci/build create mode 100644 .ci/sec.gpg.enc create mode 100644 .travis.yml create mode 100644 project/publish.sbt create mode 100644 publish.sbt diff --git a/.ci/build b/.ci/build new file mode 100755 index 0000000..f3a8cff --- /dev/null +++ b/.ci/build @@ -0,0 +1,46 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o verbose + +sbt \ + scalafmtCheck \ + +commando/test \ + +commandoJS/test \ + +commandoNative/test + +# Automatic publishing for tags that start with `v` +if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_TAG" =~ ^v[0-9].* ]]; then + # Setup gpg keys + gpg --keyserver keyserver.ubuntu.com --recv-keys "DC6A9A5E884B2D680E080467E107A4A6CF561C67" + openssl aes-256-cbc \ + -K "$encrypted_2d5a3cdf1345_key" \ + -iv "$encrypted_2d5a3cdf1345_iv" \ + -in .ci/sec.gpg.enc \ + -out sec.gpg \ + -d + gpg --import sec.gpg + + # Setup publishing + cat <<-EOF > sonatype.sbt + credentials in Global += Credentials( + "GnuPG Key ID", + "gpg", + "DC6A9A5E884B2D680E080467E107A4A6CF561C67", + "ignored" + ) + credentials in Global += Credentials( + "Sonatype Nexus Repository Manager", + "oss.sonatype.org", + "8VNUX6+2", + "$SONATYPE_PASS" + ) + EOF + + # Build and publish + sbt \ + +commando/publish \ + +commandoJS/publish \ + +commandoNative/publish \ + sonatypeRelease +fi diff --git a/.ci/sec.gpg.enc b/.ci/sec.gpg.enc new file mode 100644 index 0000000..b6531a4 Binary files /dev/null and b/.ci/sec.gpg.enc differ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e144bff --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +sudo: required +language: scala + +jdk: + - oraclejdk8 + +before_install: + - curl https://raw.githubusercontent.com/scala-native/scala-native/68122ea1ce88ff0ccfb94cbbcd4dae34b68f21cf/scripts/travis_setup.sh | bash -x + +env: + global: + secure: "XdCqDfyq6pbm8f+CEK0jS01QSqFjs1Dsqq7Kh0O4f/d4Q82fS7eKID2WGNhqt+9/jB+q2FRgF9RPVbDnIpxrmu/G1fyFoPKT0NrpqDK8UP9dT5QntRYIyUZM/sn8F3yxlMZ/c3fyHwOG7OJFWFcFE/NJa8gkF0BFyK5HBnbR72rN0ZQS3b2NyRdgUuFvnwifwpjG6oOC10Yb0i+bFjgfcwWChmLFeL/WLse3H+ir72wUYqL53/MbBAMnPxASw8DtNuNpq342aO3W9C42wcd5/HT2q4EDysa8MgRSW7J7QAk3VJPCUSG8kG3RxPZOPC2xO+jw9qrQACpuDoFx0T/o8us830vtbvTRV2QEj+ZeiJp9O449fqW4HPFVkCVajC6Wzigrey9blT33YyI//gZFQhm1AEm91jRZxUeKsSioXHcoMA/Xlak/gZ3GsmITYpIC9v0CrU5f8CJzUUa2jwtUVzyg6l3BHW+/+QVF2T0k+TTHUf9AF1207Dho8gip5qmml8n6ov+O2WK/1alChGxfoUDsG7OpclXv2PU/U2FmO25rn+ICDVTaphcflbJ8riWevfDE+CD6wfxZvteqysWk090I66nY2upy/Jl4yH/igfGwgQr1IJSiR7Hlju5jNmqhDR8y50nr9YIZCcg5sxHw4PCWJC/npwW/hlp7RkcCW0s=" + +script: .ci/build + +cache: + directories: + - "$HOME/.ivy2/cache" + - "$HOME/.sbt/boot/" +before_cache: + - find $HOME/.ivy2/cache/io.crashbox -depth -name "commando*" -exec rm -r {} \; + - find $HOME/.ivy2 -name "ivydata-*.properties" -delete + - find $HOME/.sbt -name "*.lock" -delete diff --git a/README.md b/README.md index 1684909..1641d0f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,15 @@ +[![Build Status](https://travis-ci.org/jodersky/commando.svg?branch=master)](https://travis-ci.org/jodersky/commando) + # Commando An opinionated command line parsing utility for Scala. +```scala +libraryDependencies += "io.crashbox" %% "commando" % "" +``` + +Commando is available for Scala, Scala JS and Scala Native. + ## Concepts Commando's API is designed around two main concepts: commands and parameters. It is recommended to read this section before diving into diff --git a/project/publish.sbt b/project/publish.sbt new file mode 100644 index 0000000..630c3c2 --- /dev/null +++ b/project/publish.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") +addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.1.5") diff --git a/publish.sbt b/publish.sbt new file mode 100644 index 0000000..9c0a42e --- /dev/null +++ b/publish.sbt @@ -0,0 +1,29 @@ +organization in ThisBuild := "io.crashbox" +licenses in ThisBuild := Seq( + ("BSD-3-Clause", url("https://opensource.org/licenses/BSD-3-Clause"))) +homepage in ThisBuild := Some(url("https://github.com/jodersky/commando")) +publishMavenStyle in ThisBuild := true +publishTo in ThisBuild := Some( + if (isSnapshot.value) + Opts.resolver.sonatypeSnapshots + else + Opts.resolver.sonatypeStaging +) +scmInfo in ThisBuild := Some( + ScmInfo( + url("https://github.com/jodersky/commando"), + "scm:git@github.com:jodersky/commando.git" + ) +) +developers in ThisBuild := List( + Developer( + id = "jodersky", + name = "Jakob Odersky", + email = "jakob@odersky.com", + url = url("https://crashbox.io") + ) +) +version in ThisBuild := { + import sys.process._ + ("git describe --always --dirty=-SNAPSHOT --match v[0-9].*" !!).tail.trim +} -- cgit v1.2.3