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-1.8.3.rc1 tasks/github.rake
opal-1.8.2 tasks/github.rake
opal-1.8.1 tasks/github.rake
opal-1.8.0 tasks/github.rake
opal-1.8.0.beta1 tasks/github.rake
opal-1.7.4 tasks/github.rake
opal-1.8.0.alpha1 tasks/github.rake
opal-1.7.3 tasks/github.rake
opal-1.7.2 tasks/github.rake
opal-1.7.1 tasks/github.rake
opal-1.7.0 tasks/github.rake
opal-1.7.0.rc1 tasks/github.rake
opal-1.6.1 tasks/github.rake
opal-1.6.0 tasks/github.rake
opal-1.6.0.rc1 tasks/github.rake
opal-1.6.0.alpha1 tasks/github.rake
opal-1.5.1 tasks/github.rake
opal-1.5.0 tasks/github.rake
opal-1.5.0.rc1 tasks/github.rake
opal-1.4.1 tasks/github.rake