opt-tech / sbt-art   0.1.5

Apache License 2.0 GitHub

artifact-cli plugin for sbt

Scala versions: 2.12 2.10
sbt plugins: 1.0 0.13

sbt-art

Runs artifact-cli inside sbt, manages all-in-one jar/zip artifacts in S3.

Travis CI License

Installation

1. Install artifact-cli

pip install artifact-cli

Requires Python and pip. (may need sudo)

2. Add to your plugins.sbt the line

  • project/plugins.sbt
addSbtPlugin("jp.ne.opt" % "sbt-art" % "0.1.3")

3. Write AWS configuration

  • ~/.artifact-cli.conf (prior) or project/artifact-cli.conf

Load ~/.artifact-cli.conf if it exists, otherwise load project/artifact-cli.conf.

[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bucket = your-bucket-name
region = your-region (e.g. ap-northeast-1, us-east-1)

4. Add settings to your project

First, import keys in your build.sbt or project/Build.scala.

import jp.ne.opt.sbtart.SbtArtPlugin.autoImport._

4.1 artGroupId

Group ID for artifact-cli. Default is same as your organization.

artGroupId in art := "your-group-id"

4.2 artTarget

Target file for uploading and showing information.
If your project is using sbt assembly or play dist to publish, you can write the nifty way as follows.

import sbtassembly.AssemblyKeys._

artTarget in art := (assembly in assembly).value

Note:
artTarget in art := (assemblyOutputPath in assembly).value also works. (without running assembly task)

  • For play project with universal (zip-file) distribution
import com.typesafe.sbt.SbtNativePackager.Universal

artTarget in art := (packageBin in Universal).value

4.3 artConfig (optional)

Path to the configuration file for artifact-cli is also customizable. Default is ~/.artifact-cli.conf or project/artifact-cli.conf.

artConfig in art := new File("path/to/your.conf")

Use environment variable to specify configuration file.

artConfig in art := sys.env.get("VARNAME").map(new File(_)).getOrElse((artConfig in art).value)

Tasks

You can run the following tasks in the sbt project.

Task Description Notes
art-version Prints the version number of artifact-cli.
art-list Lists all the artifacts in the group.
art-info [REVISION] Shows the information of the specified artifact. If REVISION is not set, prints the latest revision.
If artTarget is not set, this task will be skipped.
art-upload Uploads the current artifact.
If artTarget is not set, this task will be skipped.