From 0c4d80a8584977868f918dc0ed0a4734b5846feb Mon Sep 17 00:00:00 2001 From: Adrien Di Pasquale Date: Fri, 17 Mar 2023 12:00:13 +0100 Subject: [PATCH] improving scripts/deploy_gem.rb --- scripts/deploy_gem.rb | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/deploy_gem.rb b/scripts/deploy_gem.rb index 2b9da6d0..41abcc1a 100755 --- a/scripts/deploy_gem.rb +++ b/scripts/deploy_gem.rb @@ -10,13 +10,23 @@ version_without_v = match_data[1] version_with_v = "v#{version_without_v}" -`sed -E -i '' "s/[0-9]+.[0-9]+.[0-9]+/#{version_without_v}/" lib/dsfr/components/version.rb` +commands = <<~BASH.split("\n") + sed -E -i '' "s/[0-9]+.[0-9]+.[0-9]+/#{version_without_v}/" lib/dsfr/components/version.rb + bundle + git add lib/dsfr/components/version.rb Gemfile.lock + git commit -m "release version #{version_with_v}" + gem build dsfr-view-components.gemspec + git tag -a "#{version_with_v}" -m "release version #{version_with_v}" + git push + git push origin "#{version_with_v}" + gh release create "#{version_with_v}" --verify-tag --generate-notes + gem push dsfr-view-components-#{version_without_v}.gem +BASH -`git add lib/dsfr/components/version.rb` -`git commit -m "release version #{version_with_v}"` -`gem build dsfr-view-components.gemspec` -`git tag -a "#{version_with_v}" -m "release version #{version_with_v}"` -`git push` -`git push origin "#{version_with_v}"` -`gh release create "#{version_with_v}" --verify-tag` -`gem push dsfr-view-components-#{version_without_v}.gem` +commands.each do |command| + puts command + res = system(command) + raise Exception, "command failed!" unless res + + puts +end