@@ -34,6 +34,9 @@ DEB_PKG_NAME = 'github-backup-utils'
3434GH_BASE_BRANCH = ENV [ 'GH_BASE_BRANCH' ] || 'master' # TODO: should we even allow a default or require all params get set explicitly?
3535GH_STABLE_BRANCH = ""
3636
37+ # If PUBLISH is false, we leave the release in a draft state to be manually published later through the UI
38+ PUBLISH = ENV [ 'PUBLISH' ] == 'true' || false
39+
3740CHANGELOG_TMPL = '' '<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium
3841
3942<%- changes.each do |ch| -%>
@@ -332,7 +335,7 @@ def clean_up(version)
332335 `git pull --quiet origin #{ GH_BASE_BRANCH } --prune`
333336 `git branch --quiet -D release-#{ version } >/dev/null 2>&1`
334337 `git push --quiet origin :release-#{ version } >/dev/null 2>&1`
335- `git branch --quiet -D tmp-packging >/dev/null 2>&1`
338+ `git branch --quiet -D tmp-packaging >/dev/null 2>&1`
336339end
337340
338341def is_base_branch_valid? ( branch )
@@ -480,15 +483,21 @@ if $PROGRAM_NAME == __FILE__
480483 attach_assets_to_release res [ 'upload_url' ] , res [ 'id' ] , [ "#{ base_dir } /dist/#{ DEB_PKG_NAME } -v#{ version } .tar.gz" ]
481484 attach_assets_to_release res [ 'upload_url' ] , res [ 'id' ] , [ "#{ base_dir } /dist/#{ DEB_PKG_NAME } _#{ version } _all.deb" ]
482485
483- puts 'Publishing release...'
484- publish_release res [ 'id' ]
486+ if PUBLISH
487+ puts 'Publishing release...'
488+ publish_release res [ 'id' ]
489+ end
485490
486491 puts 'Cleaning up...'
487492 clean_up version
488493
489494 puts "Updating #{ GH_STABLE_BRANCH } branch..."
490495 update_stable_branch
491496
497+ if !PUBLISH
498+ puts 'Release left in a "Draft" state. Go to the https://github.com/github/backup-utils/releases and publish when ready.'
499+ end
500+
492501 puts 'Released!'
493502 rescue RuntimeError => e
494503 $stderr. puts "Error: #{ e } "
0 commit comments