|
| 1 | +help 'Run release checklist' |
| 2 | +usage 'release VERSION' |
| 3 | +action :release do |args| |
| 4 | + version = args['VERSION'] |
| 5 | + |
| 6 | + checklist = Checklist.new |
| 7 | + |
| 8 | + checklist.run "on master branch and nothing to commit" do |
| 9 | + `git status`.match /On branch master.*nothing to commit/m |
| 10 | + end |
| 11 | + |
| 12 | + checklist.run "code version is #{version}" do |
| 13 | + File.read('lib/bashly/version.rb').include? version |
| 14 | + end |
| 15 | + |
| 16 | + checklist.run "dockerfile version is #{version}" do |
| 17 | + File.read('Dockerfile').include? version |
| 18 | + end |
| 19 | + |
| 20 | + checklist.run "tag v#{version} exists" do |
| 21 | + !`git tag -l v#{version}`.empty? |
| 22 | + end |
| 23 | + |
| 24 | + checklist.run "changelog has a section for #{version}" do |
| 25 | + File.read('CHANGELOG.md').include? "v#{version}" |
| 26 | + end |
| 27 | + |
| 28 | + checklist.run "github has tag v#{version}" do |
| 29 | + checklist.url_exist? "https://github.com/DannyBen/bashly/tree/v#{version}" |
| 30 | + end |
| 31 | + |
| 32 | + checklist.run "built gem is version #{version}" do |
| 33 | + `bundle exec bashly --version`.strip == version |
| 34 | + end |
| 35 | + |
| 36 | + checklist.run "published gem is version #{version}" do |
| 37 | + checklist.url_exist? "https://rubygems.org/gems/bashly/versions/#{version}" |
| 38 | + end |
| 39 | + |
| 40 | + checklist.run "local docker image exists with tag #{version}" do |
| 41 | + `docker images`.match /bashly\s*#{version}/ |
| 42 | + end |
| 43 | + |
| 44 | + checklist.run "remote docker image exists with tag #{version}" do |
| 45 | + digest = `docker inspect --format='{{.RepoDigests}}' dannyben/bashly:#{version}`[/@sha256:(.*)\]/,1] |
| 46 | + if digest |
| 47 | + checklist.url_exist? "https://hub.docker.com/layers/dannyben/bashly/#{version}/images/sha256-#{digest}" |
| 48 | + else |
| 49 | + false |
| 50 | + end |
| 51 | + end |
| 52 | + |
| 53 | + checklist.run "github release is available for #{version}" do |
| 54 | + checklist.url_exist? "https://github.com/DannyBen/bashly/releases/tag/v#{version}" |
| 55 | + end |
| 56 | + |
| 57 | + checklist.run "version in local retype is #{version}" do |
| 58 | + YAML.load_file('/vagrant/sites/bashly/retype.yml')['branding']['label'] == "v#{version}" |
| 59 | + end |
| 60 | + |
| 61 | + checklist.run "version in remote retype is #{version}" do |
| 62 | + `curl -Ss https://raw.githubusercontent.com/DannyBen/bashly-book/master/retype.yml`.include? "label: v#{version}" |
| 63 | + end |
| 64 | + |
| 65 | + color = checklist.failed == 0 ? '!bldgrn!' : '!bldred!' |
| 66 | + say " #{color}Done with #{checklist.failed} failed tasks" |
| 67 | +end |
0 commit comments