Git Product home page Git Product logo

sbt-gitlab's Introduction

sbt-gitlab

Gitlab dependency resolution and artifact publishing for sbt

addSbtPlugin("com.gilcloud" % "sbt-gitlab" % "0.1.2") // in your project/plugins.sbt file

Usage

This plugin requires sbt 1.3.0+ as it relies on sbt.internal.CustomHTTP

Dependency Resolution

This plugin also supports dependency resolution from private gitlab package repositories, to use this you need to switch to ivy for dependency resolution rather than the now default coursier as this plugin overrides the handler for ivy. This can be done for example by adding.

ThisBuild / useCoursier := false

Publishing to Gitlab via Gitlab CI/CD

Utilizing the sbt publish command within GitLab CI/CD should require no additional configuration. This plugin automatically pulls the following GitLab environment variables which should always be provided by default within GitLab Pipelines

$CI_JOB_TOKEN   # Access Token to authorize read/writes to the gitlab pakcage registry
$CI_PROJECT_ID  # Project ID for active project pipeline. Used so Gitlab knows what project to publish the artifact under
$CI_GROUP_ID    # Gitlab Groupt ID. Used for fetching Artifacts published under the specified Group.
                # In a pipeline this would be set to the id of the group the project is under (when applicable)
$CI_SERVER_HOST # The host name for gitlab defaults to gitlab.com

Any of these 'defaults' can be overwritten in your build.sbt file

import com.gilcloud.sbt.gitlab.{GitlabCredentials,GitlabPlugin}

GitlabPlugin.autoImport.gitlabGroupId     :=  Some(12345)
GitlabPlugin.autoImport.gitlabProjectId   :=  Some(12345)
GitlabPlugin.autoImport.gitlabDomain      :=  "my-gitlab-host.com"
GitlabPlugin.autoImport.gitlabCredentials :=  Some(GitlabCredentials("Private-Token","<API-KEY>"))

// Alternatively for credential managment
// ideal for pulling artifacts locally and keeping tokens out of your source control
// see below for sample .credentials file
credentials += Credentials(Path.userHome / ".sbt" / ".credentials.gitlab"),

~/.sbt/.credentials.gitlab

realm=gitlab
host=my-git-lab-host
user=Private-Token
password=<API-KEY>

Testing

Run test for regular unit tests.

Run scripted for sbt script tests.

Publishing

  1. publish your source to GitHub
  2. create a bintray account and set up bintray credentials
  3. create a bintray repository sbt-plugins
  4. update your bintray publishing settings in build.sbt
  5. sbt publish
  6. request inclusion in sbt-plugin-releases
  7. Add your plugin to the community plugins list
  8. Claim your project an Scaladex

sbt-gitlab's People

Contributors

gilandose avatar listba avatar philipphoffmann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.