Comments (17)
Hi, thanks for the suggestion!
As currently designed, chandler relies on a ~/.netrc
file to authenticate to GitHub. For a Travis CI build, I'm not sure if this is possible. I don't know enough about Travis to say whether you can do this in a way that does not expose the password or OAuth token.
However, assuming the netrc thing can be solved, then it should just be a matter of adding these commands to the build steps:
gem install chandler
chandler push
That will sync the release notes for all tags to GitHub.
If anyone wants to suggest a solution, feel free to open a PR for the README or add your comments here.
from chandler.
Thanks for response. Will give it a try and let you know.
On Sep 3, 2016 02:07, "Matt Brictson" [email protected] wrote:
Hi, thanks for the suggestion!
As currently designed, chandler relies on a ~/.netrc file to authenticate
to GitHub. For a Travis CI build, I'm not sure if this is possible. I don't
know enough about Travis to say whether you can do this in a way that does
not expose the password or OAuth token.However, assuming the netrc thing can be solved, then it should just be a
matter of adding these commands to the build steps:gem install chandler
chandler pushThat will sync the release notes for all tags to GitHub.
If anyone wants to suggest a solution, feel free to open a PR for the
README or add your comments here.β
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAegbPNckeREXNi6qf6avB2vJ3ouhWScks5qmLpLgaJpZM4JzrrB
.
from chandler.
In theory, this could use the deploy section on the travis.yml - which sets up the .netrc
Note that travis' deploy script is run on ruby 1.9.3 - so you may have to update, then gem install
from chandler.
Another option is to run it as a part of a GitHub Releases script, which I don't know enough about to give useful advice on, however you can run pre-release scripts ( and maybe the setup github token is accessible in the ENV during that stage? )
from chandler.
@orta Thanks for the tips and ideas!
@typekpb If you'd like to try this out, you could create a simple script and reference it in the deploy
section of your travis.yml
. The script would need to do this:
gem install chandler
- Create a
.netrc
file so that it contains the desired GitHub username and OAuth token chandler push $TRAVIS_TAG
Also, I'm guessing you'd probably only want the script to run when $TRAVIS_TAG
is present.
TRAVIS_TAG: If the current build is for a git tag, this variable is set to the tagβs name.
You could store the OAuth token as an encrypted environment variable.
And, as @orta mentioned, you'll need to run the deploy script in a newer version of Ruby, since chandler requires Ruby 2.1+ and the default Ruby used by Travis is 1.9.3.
One way we could make this slightly simpler is if chandler could use environment variables for the GitHub credentials, and bypass the need to set up a .netrc
file. Perhaps it could check for the presence of $GITHUB_USERNAME
and $GITHUB_TOKEN
or something like that.
Anyway, let me know if you get this working, and if you need my help to make any modifications to chandler itself. Thanks!
from chandler.
@mattbrictson @orta thanks a lot guys for your help!
I finally managed it. However it's been rather a painful process, let me document the steps required:
-
relevant
.travis.yml
chunks (please note I'm using go with sudo: false, not sure about other setups):language: go sudo: false ... before_deploy: # chandler needs ruby version >= 2.2 => install it via rvm (reuse travis installed one) - ruby -v && rvm install 2.3.1 && rvm use --default 2.3.1 && ruby -v - ./travis/before_deploy.sh
-
./travis/before_deploy.sh
chunk:#!/bin/bash ... gem install --no-ri --no-rdoc chandler # setup credentials cp -f travis/.netrc ~/.netrc chmod 600 ~/.netrc sed -i.bak "s/###OAUTH_LOGIN###/${OAUTH_LOGIN}/" ~/.netrc sed -i.bak "s/###OAUTH_TOKEN###/${OAUTH_TOKEN}/" ~/.netrc chandler --changelog=$(pwd)/docs/CHANGELOG.md --github=foo/foo push
-
./travis/.netrc
contents:machine api.github.com login ###OAUTH_LOGIN### password ###OAUTH_TOKEN###
-
moreover I had to setup environment variables in the travis-ci, namely:
OAUTH_LOGIN
andOAUTH_TOKEN
Well, as you mentioned, it would be really nice, if we could skip ~/.netrc
part and use env vars only. Any chance to use the secured ones directly in the .travis.yml (via: secure: ...
) ? As I'm worried about getting them exposed somehow anyway in a way I use those.
from chandler.
Secured tokens would work - I have a branch that would work with it, but I'm finding it really hard to test my changes.
from chandler.
if you need a test volunteer, I'd be happy give it a try on my project, the only issue would be: how to install the version you're referring to on travis?
from chandler.
You'd have to use a Gemfile:
gem 'chandler', :git => "https://github.com/orta/chandler.git", :branch => "token"
pretty arduous
from chandler.
well, it's a golang project, but if you provide me with a steps, I'd be happy to (as I hope this could find it's way to official release)
from chandler.
Until it's shipped as a part of chandler, it's arguably more effort to do than what you have right now ( suddenly you have ruby dependency management to handle on-top of your usual bits ) - I'd recommend against it for this second
from chandler.
OK, thanks for info, will wait then.
On Wed, Sep 7, 2016 at 9:36 PM, Orta [email protected] wrote:
Until it's shipped as a part of chandler, it's arguably more effort to do
than what you have right now ( suddenly you have ruby dependency management
to handle on-top of your usual bits ) - I'd recommend against it for this
secondβ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAegbCyU1jSk11fkFPVJRFdRMtXfhtWYks5qnxI6gaJpZM4JzrrB
.
from chandler.
@orta Your branch is looking great so far! Is there any way I can help you get it ready to merge?
Perhaps to make testing easier, you could put the Octokit logic in Chandler::Configuration
, like this:
module Chandler
class Configuration
# ...
def octokit
@octokit ||= begin
# construct with :access_token or :netrc, based on ENV
end
end
end
end
And then change Chandler::GitHub
to use config.octokit
instead of calling Octokit::Client.new
.
That way you can unit test the ENV-based logic independently in configuration_test.rb
; that should be sufficient without needing to do an integration test, IMO.
from chandler.
@typekpb I merged #16 and released chandler 0.5.0 with GitHub auth token environment variable support, thanks to @orta's contribution. Give it a shot!
from chandler.
And this is how we do it on Danger in Travis too: danger/danger#620
Thanks @mattbrictson
from chandler.
@typekpb Did you get this working? I'd like to close this issue, unless there is more that Chandler needs to do to support Travis.
from chandler.
I'm considering this solved. Closing.
from chandler.
Related Issues (20)
- Don't strip all leading whitespace from release notes HOT 1
- Github enterprise HOT 4
- Allow other formats HOT 3
- customizable release title HOT 3
- allow specify version to update HOT 1
- gitlab support HOT 2
- strip markdown links HOT 7
- Warn before overwriting existing releases HOT 2
- Feature request: Rake task for automatically invoking Chandler in projects that lack a .gemspec HOT 6
- Allow configuration of chandler through a dotfile HOT 2
- (Optional) replace full GH issue links with just #NUMBER HOT 1
- More gentle error on not existing tag HOT 2
- Tag-Prefix does not work as expected HOT 2
- Gentle Version Handling HOT 4
- Consider using vandamme gem to parse changelogs
- on release notes update are version dates overwritten to current date HOT 7
- source code requires UTF-8 HOT 4
- Auto-uploading binaries HOT 2
- Workflow question HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chandler.