Skip to content

Commit

Permalink
Refresh outdated bin/release
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Jul 15, 2024
1 parent b306068 commit f05e723
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions bin/release
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env ruby
require "bundler/inline"
gemfile(true, quiet: true) do
source "https://rubygems.org"
gem "github_api", "~> 0.13.1"
end

require "bundler/setup"
require "github_api"
require "pathname"
require "json"
Expand All @@ -16,15 +20,14 @@ class Release
check_npm

build
update_package_json
update_copyright_year
commit_changes
create_release
npm_publish
end

def version
@version ||= Pathname.new("src/trix/VERSION").read.chomp
@version ||= JSON.load_file("package.json")["version"]
end

def confirm_version
Expand All @@ -33,16 +36,7 @@ class Release

def build
puts "Building…"
system("rm -rf tmp/ && bin/blade build") || abort("Build failed")
end

def update_package_json
puts "Updating package.json…"

pathname = Pathname.new("package.json")
data = JSON.parse(pathname.read)
data["version"] = version
pathname.write(JSON.pretty_generate(data) + "\n")
system("yarn install && yarn build") || abort("Build failed")
end

def update_copyright_year
Expand Down Expand Up @@ -111,16 +105,7 @@ class Release
end

def github
@github ||= begin
username = `git config --global --get github.user`.chomp
password = `git config --global --get github.token`.chomp

if username.nil? || username == "" || password.nil? || password == ""
abort "Must set github.user and github.token in your global gitconfig"
end

Github.new basic_auth: "#{username}:#{password}"
end
@github ||= Github.new(oauth_token: ENV.fetch("GITHUB_TOKEN"))
end

def check_npm
Expand Down

2 comments on commit f05e723

@afcapel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeremy bin/release is outdated and should probably be deleted, but yarn release should work ok. You just need to run it from the revision you want to publish, and it will ask you for the new version number.

@jeremy
Copy link
Member Author

@jeremy jeremy commented on f05e723 Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @afcapel 😊

Please sign in to comment.