Class: Decidim::Releaser

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/releaser.rb

Defined Under Namespace

Classes: InvalidMetadataError

Constant Summary collapse

DECIDIM_VERSION_FILE =
".decidim-version"

Instance Method Summary collapse

Constructor Details

#initialize(token:, exit_with_unstaged_changes:) ⇒ Releaser

Returns a new instance of Releaser.

Parameters:

  • token (String)

    token for GitHub authentication

  • exit_with_unstaged_changes (Boolean)

    wheter we should exit cowardly if there is any unstaged change



13
14
15
16
# File 'lib/decidim/releaser.rb', line 13

def initialize(token:, exit_with_unstaged_changes:)
  @token = token
  @exit_with_unstaged_changes = exit_with_unstaged_changes
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/decidim/releaser.rb', line 18

def call
  exit_if_unstaged_changes if @exit_with_unstaged_changes

  run("git checkout #{release_branch}")
  run("git pull origin #{release_branch}")
  bump_decidim_version!
  run("bin/rake update_versions")
  run("bin/rake bundle")
  run("npm install")
  generate_changelog

  # rubocop:disable Rails/Output
  puts "You need to prepare the CHANGELOG.md by merging the three files: RELEASES_NOTES.md, temporay_changelog.md and CHANGELOG.md"
  puts "After you finish leave the change staged"
  system ENV.fetch("SHELL")
  # rubocop:enable Rails/Output

  run("git checkout -b chore/prepare/#{version_number}")
  run("git commit -a -m 'Prepare #{version_number} release'")
  run("git push origin chore/prepare/#{version_number}")
end