toys-release 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,6 @@ module Toys
6
6
  # Current version of the Toys release system.
7
7
  # @return [String]
8
8
  #
9
- VERSION = "0.3.1"
9
+ VERSION = "0.4.0"
10
10
  end
11
11
  end
@@ -13,7 +13,7 @@ jobs:
13
13
  release-process-request:
14
14
  if: ${{ github.repository == '<%= @settings.repo_path %>' }}
15
15
  env:
16
- ruby_version: "3.4"
16
+ ruby_version: "4.0"
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - name: Install Ruby ${{ env.ruby_version }}
@@ -13,7 +13,7 @@ jobs:
13
13
  release-update-open-requests:
14
14
  if: ${{ github.repository == '<%= @settings.repo_path %>' }}
15
15
  env:
16
- ruby_version: "3.4"
16
+ ruby_version: "4.0"
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - name: Install Ruby ${{ env.ruby_version }}
@@ -23,7 +23,7 @@ jobs:
23
23
  release-perform:
24
24
  if: ${{ github.repository == '<%= @settings.repo_path %>' }}
25
25
  env:
26
- ruby_version: "3.4"
26
+ ruby_version: "4.0"
27
27
  runs-on: ubuntu-latest
28
28
  steps:
29
29
  - name: Install Ruby ${{ env.ruby_version }}
@@ -16,7 +16,7 @@ jobs:
16
16
  release-request:
17
17
  if: ${{ github.repository == '<%= @settings.repo_path %>' }}
18
18
  env:
19
- ruby_version: "3.4"
19
+ ruby_version: "4.0"
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
22
  - name: Install Ruby ${{ env.ruby_version }}
@@ -20,7 +20,7 @@ jobs:
20
20
  release-retry:
21
21
  if: ${{ github.repository == '<%= @settings.repo_path %>' }}
22
22
  env:
23
- ruby_version: "3.4"
23
+ ruby_version: "4.0"
24
24
  runs-on: ubuntu-latest
25
25
  steps:
26
26
  - name: Install Ruby ${{ env.ruby_version }}
data/toys/.toys.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- toys_version!("~> 0.18")
3
+ toys_version!(">= 0.19", "< 2")
4
4
 
5
5
  desc "Namespace for toys-release tools"
@@ -29,12 +29,12 @@ def run
29
29
  end
30
30
  end
31
31
 
32
- expected_labels = create_expected_labels
32
+ expected_labels = define_expected_labels
33
33
  cur_labels = load_existing_labels
34
34
  update_labels cur_labels, expected_labels
35
35
  end
36
36
 
37
- def create_expected_labels
37
+ def define_expected_labels
38
38
  [
39
39
  {
40
40
  "name" => @settings.release_pending_label,
@@ -76,16 +76,7 @@ def update_labels(cur_labels, expected_labels)
76
76
  create_label(expected)
77
77
  end
78
78
  end
79
- release_related_labels = [
80
- @settings.release_pending_label,
81
- @settings.release_error_label,
82
- @settings.release_aborted_label,
83
- @settings.release_complete_label,
84
- ]
85
- cur_labels.each do |cur|
86
- next unless release_related_labels.include?(cur["name"])
87
- delete_label(cur) unless expected_labels.find { |label| label["name"] == cur["name"] }
88
- end
79
+ puts "GitHub labels updated.", :green, :bold
89
80
  end
90
81
 
91
82
  def create_label(label)
@@ -95,6 +86,7 @@ def create_label(label)
95
86
  exec(["gh", "api", "repos/#{@settings.repo_path}/labels", "--input", "-",
96
87
  "-H", "Accept: application/vnd.github.v3+json"],
97
88
  in: [:string, body], out: :null, e: true)
89
+ puts "Created label #{label_name.inspect}", :green
98
90
  end
99
91
 
100
92
  def update_label(label)
@@ -104,12 +96,5 @@ def update_label(label)
104
96
  exec(["gh", "api", "-XPATCH", "repos/#{@settings.repo_path}/labels/#{label_name}",
105
97
  "--input", "-", "-H", "Accept: application/vnd.github.v3+json"],
106
98
  in: [:string, body], out: :null, e: true)
107
- end
108
-
109
- def delete_label(label)
110
- label_name = label["name"]
111
- return unless yes || confirm("Label \"#{label_name}\" unrecognized. Delete? ", default: true)
112
- exec(["gh", "api", "-XDELETE", "repos/#{@settings.repo_path}/labels/#{label_name}",
113
- "-H", "Accept: application/vnd.github.v3+json"],
114
- out: :null, e: true)
99
+ puts "Updated fields of label #{label_name.inspect}", :green
115
100
  end
data/toys/gen-gh-pages.rb CHANGED
@@ -115,7 +115,7 @@ def generate_file(template, destination, data, remove_dir: false)
115
115
  content = erb.result(ErbContext.get(data))
116
116
  content = yield(content, old_content) if block_given? && old_content
117
117
  ::File.write(destination, content)
118
- puts "Wrote #{destination}."
118
+ puts "Wrote #{destination}.", :green
119
119
  end
120
120
 
121
121
  def file_generation_confirmations(destination, remove_dir)
@@ -65,12 +65,13 @@ def generate_all_files
65
65
  "release-retry.yml",
66
66
  ]
67
67
  files.each { |name| generate_file(name) }
68
+ puts "Workflow files generated.", :green, :bold
68
69
  end
69
70
 
70
71
  def generate_file(name)
71
72
  destination = ::File.join(workflows_dir, name)
72
73
  if ::File.readable?(destination)
73
- puts "Destination file #{destination} exists.", :yellow, :bold
74
+ puts "Destination file #{destination} exists.", :yellow
74
75
  return unless yes || confirm("Overwrite? ", default: true)
75
76
  else
76
77
  return unless yes || confirm("Create file #{destination}? ", default: true)
@@ -82,6 +83,6 @@ def generate_file(name)
82
83
 
83
84
  ::File.open(destination, "w") do |file|
84
85
  file.write(erb.result(ErbContext.get(@settings)))
85
- puts "Wrote #{destination}.", :green, :bold
86
+ puts "Wrote #{destination}.", :green
86
87
  end
87
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toys-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
@@ -81,10 +81,10 @@ homepage: https://github.com/dazuma/toys
81
81
  licenses:
82
82
  - MIT
83
83
  metadata:
84
- changelog_uri: https://dazuma.github.io/toys/gems/toys-release/v0.3.1/file.CHANGELOG.html
84
+ changelog_uri: https://dazuma.github.io/toys/gems/toys-release/v0.4.0/file.CHANGELOG.html
85
85
  source_code_uri: https://github.com/dazuma/toys/tree/main/toys-release
86
86
  bug_tracker_uri: https://github.com/dazuma/toys/issues
87
- documentation_uri: https://dazuma.github.io/toys/gems/toys-release/v0.3.1
87
+ documentation_uri: https://dazuma.github.io/toys/gems/toys-release/v0.4.0
88
88
  rdoc_options: []
89
89
  require_paths:
90
90
  - lib
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.6.9
102
+ rubygems_version: 4.0.3
103
103
  specification_version: 4
104
104
  summary: Release system using GitHub Actions and Toys
105
105
  test_files: []