Git Product home page Git Product logo

travis-sonatype-deployer's Introduction

Deploy to Maven Central from Travis CI

Build Status

This is an example repository that demonstrates how a library can be automatically published to Maven Central using Travis CI.

This repository is published under the MIT license. Feel free to copy whatever is useful for you.

Sources

This repository is built on my experience with publishing libraries to Maven Central and Nathan Fischer's fantastic walkthrough "Complete guide to continuous deployment to maven central from Travis CI".

Prerequisites

You need GnuPG 2.x for signing the artifacts and the Travis Client for encrypting secrets. If you don't have them on your local machine then you can use a VM. This repository supports Vagrant. With

vagrant up

you can start a VM with the necessary tools.

Create GPG keys

Artifacts that are uploaded to Maven Central must be signed. Therefore you need GPG keys. Create your GPG keys with

gpg --generate-key

Export your public and private key

gpg --export --armor someone@somewhere > deployment/signingkey.asc
gpg --export-secret-keys --armor someone@somewhere >> deployment/signingkey.asc

Store Secrets

Travis needs to know your passphrase, and Sonatype credentials for deploying to Maven Central. These are secrets and therefore you must not store them as plaintext in your repository. Therefore Travis provides support for encrypting secrets. The ciphertexts can be stored in the repository. First you need to login to Travis

travis login --pro

and then encrypt the secrects and add them to you .travis.yml file

travis encrypt PASSPHRASE=... --pro --add
travis encrypt SONATYPE_USERNAME=... --pro --add
travis encrypt SONATYPE_PASSWORD=... --pro --add

You also need to encrupt the file with the GPG keys.

travis encrypt-file deployment/signingkey.asc deployment/signingkey.asc.enc --pro --add

Delete the unencrypted file afterwards

rm deployment/signingkey.asc

The flag --pro must not be used if your project is still built on travis-ci.org (all new projects are built on travis-ci.com).

travis-sonatype-deployer's People

Contributors

stefanbirkner avatar abdullahawara avatar

Watchers

 avatar

Forkers

anas-almoulhem

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.