sbt-package-courier
September 28, 2017 ยท View on GitHub
Plugin to deliver native packages to artifact storage
Requirements
sbt-native-packager- latest stable release1.2.2linked transitively, but should work with higher versions tooArtifactory Pro 4.+with configureddeborrpmrepository
Setup
Add plugin dependency to project/plugins.sbt:
addSbtPlugin("io.sysa" % "sbt-package-courier" % "0.2.0")
Usage
Deb publishing
Assuming that sbt-native-packager is configured to build deb packages, Artifactory is hosted at https://repo.acme.corp/artifactory and apt repository is called apt-repo,
the possible definitions of setting keys can be:
enablePlugins(DebArtifactoryDeployPlugin)
debianArtifactoryUrl in Debian := "https://repo.acme.corp/artifactory"
debianArtifactoryCredentials in Debian := Some(Credentials(Path.userHome / ".ivy2" / ".credentials"))
debianArtifactoryRepo in Debian := "apt-repo"
debianArtifactoryPath in Debian := s"pool/${packageName.value}"
debianArtifactoryDistribution in Debian := Seq("debian", "ubuntu")
debianArtifactoryComponent in Debian := Seq("main")
debianArtifactoryArchitecture in Debian := Seq("i386", "amd64")
publish in Debian := (debianArtifactoryPublish in Debian).value
Credentials are optional, although by default Artifactory requires authentication for publishing.
Multiple values of Distribution, Component, Architecture can be specified, thus Matrix publishing will be performed. By default Architecture is set to native-packager's packageArchitecture.
Then publishing is done with:
> sbt debian:publish
Rpm publishing
Assuming that sbt-native-packager is configured to build rpm packages, Artifactory is hosted at https://repo.acme.corp/artifactory and rpm repository is called rpm-repo possible definitions of setting keys can be:
enablePlugins(RpmArtifactoryDeployPlugin)
rpmArtifactoryUrl in Rpm := "https://repo.acme.corp/artifactory"
rpmArtifactoryCredentials in Rpm := Some(Credentials(Path.userHome / ".ivy2" / ".credentials"))
rpmArtifactoryRepo in Rpm := "rpm-repo"
rpmArtifactoryPath in Rpm := s"pool/${packageName.value}"
publish in Rpm := (rpmArtifactoryPublish in Rpm).value
Be aware that correct nesting in rpmArtifactoryPath is critical for proper work of rpm repo. Read more about repodata depth
Then publishing is done with:
> sbt rpm:publish
Future plans
- trigger index recalculation on publishing
- other artifact storages: Aptly, Bintray, PackageCloud to name a few.