travis-ci GitHub release upload is unauthorized

285 Views Asked by At

I am trying to automate uploading binaries of C++ library as GitHub Releases with Travis-CI. The release is set up to proceed with encrypted token from a user with admin privileges on repository. Everything is according to the docs, but still getting my builds failed with this error:

`on_complete': GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

Please see details at: https://api.travis-ci.com/v3/job/161301399/log.txt

Let me clarify how I set up a release:

$ travis login
    # Answer the security challenge with GitHub username/password
$ travis setup releases --com 
    # Answer the security challenge with GitHub username/password
    # Answer few more questions

I do the --com part since the repository was recently moved to travis-ci.com and the job is performed there. However, I also tried the --pro and `` (no option, default to .org).

So here is deploy section of my .travis.yml:

deploy:
  provider: releases
  skip_cleanup: true
  draft: true
  overwrite: true
  api_key:
    secure: [... omitted ...]
  file: ${DISTRIBUTION_NAME}
  on:
    all_branches: true

As for now I've run out of options, so any advice would be highly appreciated.

1

There are 1 best solutions below

0
On

Well, after banging my head against the wall for the straight 3 hours, it come to my attention that I was encrypting OAuth token as secret for different repo.

Namely, travis setup releases (and updated .travis.yml) mentioned Multy-io/Multy-back while I was working on script for Multy-io/Multy-Core project.

This is leftover from setting up previous project. Please note that you might want to explicitly set the repository to avoid similar issue with:

with travis setup releases -r Name/Repo