@@ -34,6 +34,9 @@ DEB_PKG_NAME = 'github-backup-utils'
34
34
GH_BASE_BRANCH = ENV [ 'GH_BASE_BRANCH' ] || 'master' # TODO: should we even allow a default or require all params get set explicitly?
35
35
GH_STABLE_BRANCH = ""
36
36
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
+
37
40
CHANGELOG_TMPL = '' '<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium
38
41
39
42
<%- changes.each do |ch| -%>
@@ -332,7 +335,7 @@ def clean_up(version)
332
335
`git pull --quiet origin #{ GH_BASE_BRANCH } --prune`
333
336
`git branch --quiet -D release-#{ version } >/dev/null 2>&1`
334
337
`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`
336
339
end
337
340
338
341
def is_base_branch_valid? ( branch )
@@ -480,15 +483,21 @@ if $PROGRAM_NAME == __FILE__
480
483
attach_assets_to_release res [ 'upload_url' ] , res [ 'id' ] , [ "#{ base_dir } /dist/#{ DEB_PKG_NAME } -v#{ version } .tar.gz" ]
481
484
attach_assets_to_release res [ 'upload_url' ] , res [ 'id' ] , [ "#{ base_dir } /dist/#{ DEB_PKG_NAME } _#{ version } _all.deb" ]
482
485
483
- puts 'Publishing release...'
484
- publish_release res [ 'id' ]
486
+ if PUBLISH
487
+ puts 'Publishing release...'
488
+ publish_release res [ 'id' ]
489
+ end
485
490
486
491
puts 'Cleaning up...'
487
492
clean_up version
488
493
489
494
puts "Updating #{ GH_STABLE_BRANCH } branch..."
490
495
update_stable_branch
491
496
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
+
492
501
puts 'Released!'
493
502
rescue RuntimeError => e
494
503
$stderr. puts "Error: #{ e } "
0 commit comments