Sha256: dd73ee33a604605e5a12b8c90656f2efd3ac8d36ff74c516667be2f9ff44c705

Contents?: true

Size: 1.1 KB

Versions: 91

Compression:

Stored size: 1.1 KB

Contents

namespace :github do
  desc "Upload assets to github"
  task :upload_assets do
    require 'octokit'
    # https://github.com/octokit/octokit.rb#oauth-access-tokens
    token_path = '.github_access_token'
    File.exist?(token_path) or raise ArgumentError, "Please create a personal access token (https://github.com/settings/tokens/new) and paste it inside #{token_path.inspect}"
    token = File.read(token_path).strip
    client = Octokit::Client.new :access_token => token
    tag_name = ENV['TAG'] || raise(ArgumentError, 'missing the TAG env variable (e.g. TAG=v0.4.4)')
    release = client.releases('opal/opal').find{|r| p(r.id); p(r).tag_name == tag_name}
    release_url = "https://api.github.com/repos/opal/opal/releases/#{release.id}"
    %w[opal opal-parser].each do |name|
      client.upload_asset release_url, "build/#{name}.js", :content_type => 'application/x-javascript'
      client.upload_asset release_url, "build/#{name}.min.js", :content_type => 'application/x-javascript'
      client.upload_asset release_url, "build/#{name}.min.js.gz", :content_type => 'application/octet-stream'
    end
  end
end

Version data entries

91 entries across 91 versions & 3 rubygems

Version Path
opal-0.11.4 tasks/github.rake
opal-0.11.3 tasks/github.rake
opal-0.11.2 tasks/github.rake
opal-0.11.1 tasks/github.rake
opal-0.11.1.pre tasks/github.rake
opal-0.10.6 tasks/github.rake
opal-0.10.6.beta tasks/github.rake
opal-0.11.0 tasks/github.rake
opal-0.10.5 tasks/github.rake
opal-0.10.4 tasks/github.rake
opal-0.11.0.rc1 tasks/github.rake
opal-0.10.3 tasks/github.rake
opal-0.10.2 tasks/github.rake
opal-0.10.1 tasks/github.rake
opal-0.10.0 tasks/github.rake
opal-0.10.0.rc2 tasks/github.rake
opal-0.9.4 tasks/github.rake
opal-0.9.3 tasks/github.rake
opal-0.10.0.rc1 tasks/github.rake
opal-0.10.0.beta5 tasks/github.rake