Sha256: 71a031f01d5096c12f58c06374630e90f3eef2072101184039e117ec3ec0b1e2

Contents?: true

Size: 1.06 KB

Versions: 70

Compression:

Stored size: 1.06 KB

Contents

Dir[File.join(Dir.pwd, 'tasks', '**', '*.rb')].each { |f| require f }

require 'digest'
require 'octokit'
require 'pathname'

module Distribution
  class Release
    extend Forwardable
    include PackageHelpers

    attr_reader :tarball, :github, :package

    def_delegators :@tarball, :package, :version, :file

    def initialize(tarball)
      @tarball = tarball
      @github = Octokit::Client.new access_token: ENV['OCTODOWN_TOKEN']
    end

    def self.create(tarball)
      release = new(tarball)
      release.create_new_release
    end

    def create_new_release
      print_to_console 'Publishing release to GitHub...'
      github.create_release(
        'datapimp/brief',
        "v#{version}",
        name: "v#{version}",
        body: ReleaseNotes.new.content
      )
    end

    def upload_asset
      print_to_console 'Uploading to GitHub...'
      github.upload_asset find_upload_url, file
    end

    private

    def find_upload_url
      Octokit.releases('datapimp/brief').find do |n|
        n.tag_name == "v#{version}"
      end[:url]
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
brief-1.17.14 tasks/distribution/release.rb
brief-1.17.13 tasks/distribution/release.rb
brief-1.17.12 tasks/distribution/release.rb
brief-1.17.11 tasks/distribution/release.rb
brief-1.17.10 tasks/distribution/release.rb
brief-1.17.9 tasks/distribution/release.rb
brief-1.17.8 tasks/distribution/release.rb
brief-1.17.7 tasks/distribution/release.rb
brief-1.17.5 tasks/distribution/release.rb
brief-1.17.4 tasks/distribution/release.rb
brief-1.17.3 tasks/distribution/release.rb
brief-1.17.2 tasks/distribution/release.rb
brief-1.17.1 tasks/distribution/release.rb
brief-1.17.0 tasks/distribution/release.rb
brief-1.16.2 tasks/distribution/release.rb
brief-1.16.1 tasks/distribution/release.rb
brief-1.16.0 tasks/distribution/release.rb
brief-1.15.5 tasks/distribution/release.rb
brief-1.15.4 tasks/distribution/release.rb
brief-1.15.3 tasks/distribution/release.rb