GithubHelp home page GithubHelp logo

travisdrat's Introduction

travisDrat

Deploy your package to a github drat repo from Travis-CI.

This R package is heavily inspired by Colin Gillespie and Dirk Eddelbuettel's blog post http://eddelbuettel.github.io/drat/CombiningDratAndTravis.html.

Usage

Step 0

0.1 - Generate a Personal Access Token

From Dirk's blog:

To allow Travis CI to push to your GitHub repository, we need to generate a GitHub API token. After re-entering your password, just select repo, or if your repository is public, select public_repo. GitHub will create the token and give you a chance to copy it down.

I recommend making a public_repo token only as the drat repo will be publicly available on the gh-pages branch.

0.2 - Setup a Personal drat Repo

Create a new github repository called drat with a gh-pages branch. drat will take care of the rest.

Once your Github drat repo is available, create and init the gh-pages branch programatically with...

# Create local github drat repo
drat::initRepo("drat", ".")
# Init drat repo
repo <- git2r::repository("drat")
# Add github remote to the global defined github user
git2r::remote_add(repo, "origin", paste0("https://github.com/", git2r::config()$global$github.user, "/drat.git"))
# Push the init'ed repo
git2r::push(repo, "origin", "refs/heads/gh-pages", credentials = git2r::cred_token())
# Delete local repo (not needed anymore)
unlink("drat", recursive = TRUE)

To verify that it was successful, visit your newly created github webpage. Mine is https://schloerke.github.io/drat/README.md

0.3 - Activate Repository on Travis

Visit your profile on Travis. Make sure your R package repository is active and ready to be checked on Travis.

Step 1 - Encrypt Personal Access Token

Create a secure personal access token (PAT) that can be used in Travis safely.

# Add the token to env.global automatically
travisDrat::secure_token()

# Display only
travisDrat::secure_token(add = FALSE)

The .travis.yml file should contain the fields:

env:
  global:
    secure: "REALLYLONGENCRYPTEDKEYTHATISNOTHUMANREADABLE"

Step 2 - Update .travis.yml

Add the following lines to your travis file:

r_github_packages:
  - schloerke/travisDrat

after_success:
  - Rscript -e "travisDrat::deploy_drat()"

Step 3 - Deploy

Push commits to Github. Travis will activate on the package web hook. After a successful check of your R package, travisDrat will deploy to the drat repo provided.

Step 4 - Use Deployed Repo

# Add personal drat repo
drat::addRepo("schloerke")

# Add any github user drat repo
drat::addRepo("GITHUB_USER")

travisdrat's People

Contributors

schloerke avatar

Stargazers

 avatar

Watchers

 avatar  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.