Sha256: 9753fdf5eaba1bfd3970315b51596adaba73df8005292cb133c4bdb7ae42d73a

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'travis/cli/setup'
require 'travis/tools/github'

module Travis
  module CLI
    class Setup
      class Releases < Service
        description 'Upload Assets to GitHub Releases'

        def run
          deploy 'releases' do |config|
            github.with_token { |t| config['api_key'] = t }
            raise Travis::Client::GitHubLoginFailed, 'all GitHub tokens given were invalid' if config['api_key'].nil?

            config['file'] = ask('File to Upload: ').to_s
          end
        end

        def github
          @github ||= begin
            load_gh
            Tools::Github.new(session.config['github']) do |g|
              g.drop_token    = false
              g.github_token  = github_token
              g.debug         = proc { |log| debug(log) }
              g.after_tokens  = proc { g.explode = true and error('no suitable github token found') }
              g.scopes        = org? ? ['public_repo'] : ['repo']
              g.note          = "automatic releases for #{repository.slug}"
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
travis-1.13.3 lib/travis/cli/setup/releases.rb
travis-1.13.2 lib/travis/cli/setup/releases.rb
travis-1.13.1 lib/travis/cli/setup/releases.rb
travis-1.13.0 lib/travis/cli/setup/releases.rb
travis-1.12.0 lib/travis/cli/setup/releases.rb