Instantly share code, notes, and snippets.

What would you like to do?
extern crate hyper;
extern crate hubcaps;
use std::{env, process};
use hyper::Client;
use hubcaps::{Github, ReleaseOptions, Credentials};
fn main() {
env_logger::init().expect("Can't instantiate env logger");
let token = match env::var("GH_TOKEN") {
Ok(token) => token,
_ => {
println!("example missing GH_TOKEN");
let client = Client::new();
let credentials = Credentials::Token(token);
let github = Github::new(
format!("hubcaps/{}", env!("CARGO_PKG_VERSION")),
let user = "username";
let repo = "my-library";
let name = "ONE DOT OH";
let body = "This is a long long body";
let tag = "v1.0.0";
let opts = ReleaseOptions::builder(tag)
let repo = github.repo(user, repo);
let release = repo.releases();
match release.create(&opts) {
Ok(_) => println!("Release created"),
Err(e) => println!("Failed to create release: {:?}", e),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment