drdoctr / doctr

A tool for automatically deploying docs from Travis CI to GitHub pages.
https://drdoctr.github.io
MIT License
107 stars 30 forks source link

Fix travis-ci.com stuff #337

Closed asmeurer closed 5 years ago

asmeurer commented 5 years ago

It apparently doesn't require authentication to use travis-ci.com, unless the repo is private, so this simplifies things a lot.

I am still testing this out. I should figure out how to create a private repo to test that as well. I had thought GitHub had free private repos now, but it won't let me create one on drdoctr.

Fixes #335.

asmeurer commented 5 years ago

There are now four drdoctr/testing-travis-ci-* repos to test the four combinations. Each repo indicates how it should be set up in its README. These are used in the test suite to make sure check_repo_exists does the right thing.

asmeurer commented 5 years ago

I guess I can create one, but only on my personal account. It won't let me create it on drdoctr.

I've made https://github.com/asmeurer/doctr-private-repo-testing (no one but me will be able to see it). I need to figure out how to get the Travis testing token so it can access it.

asmeurer commented 5 years ago

I don't understand why the tests are failing. They work for me locally, after commenting out the skip. Are Travis API requests results different when run on Travis itself?

asmeurer commented 5 years ago

Oh the token is for GitHub, not Travis. So it fails because of the token.

asmeurer commented 5 years ago

Apparently I only get 100 trial builds for my private repo before I have to pay Travis. So hopefully I get this fixed soon.

asmeurer commented 5 years ago

And I guess you have to pay GitHub to use pages on a private repo. But you can still confirm that the push works on the gh-pages branch.

asmeurer commented 5 years ago

It looks like the private repo build works, both for a token and a deploy key.

asmeurer commented 5 years ago

I want to get some build testing on the doctr/testing-* repos, just to make sure the whole flow works correctly. Unfortunately, the way this is designed, only one of travis-ci.com/.org is supported at a time, so we can't automatically test both on this repo. I think it shouldn't be a big deal, as virtually all the complexity there is on the configure side. The only difference on Travis is the URL that is included in the commit message.

asmeurer commented 5 years ago

OK, I tested it all and it all seems to work.

Remarkably, you can actually enable a repo on both .com and .org and deploy from both. You just need to add both secure environment variables to .travis.yml, and then rename the encryption key files so that you have both of them, and then do something like

  - |
    if [[ $TRAVIS_BUILD_WEB_URL == *"travis-ci.com"* ]]; then
        doctr deploy --built-docs test . --key-path github_deploy_key-com.enc;
    else
        doctr deploy --built-docs test . --key-path github_deploy_key-org.enc;
    fi

You can see that it works

https://travis-ci.org/drdoctr/testing-travis-ci-both https://travis-ci.com/drdoctr/testing-travis-ci-both https://github.com/drdoctr/testing-travis-ci-both/commits/gh-pages

I can't see a legitimate use-case for this, so I'll probably only mention it in the release notes.