Merge pull request #494 from github/enterprise-3.6-backport-conditional-publish

Backport 491 for 3.6: Leave release in draft state by default
This commit is contained in:
Devin Dooley 2023-08-15 13:34:45 -07:00 коммит произвёл GitHub
Родитель e90e4f333f f98d6337a4
Коммит ccd6cefc1d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -34,6 +34,9 @@ DEB_PKG_NAME = 'github-backup-utils'
GH_BASE_BRANCH = ENV['GH_BASE_BRANCH'] || 'master' # TODO: should we even allow a default or require all params get set explicitly?
GH_STABLE_BRANCH = ""
# If PUBLISH is false, we leave the release in a draft state to be manually published later through the UI
PUBLISH = ENV['PUBLISH'] == 'true' || false
CHANGELOG_TMPL = '''<%= package_name %> (<%= package_version %>) UNRELEASED; urgency=medium
<%- changes.each do |ch| -%>
@ -332,7 +335,7 @@ def clean_up(version)
`git pull --quiet origin #{GH_BASE_BRANCH} --prune`
`git branch --quiet -D release-#{version} >/dev/null 2>&1`
`git push --quiet origin :release-#{version} >/dev/null 2>&1`
`git branch --quiet -D tmp-packging >/dev/null 2>&1`
`git branch --quiet -D tmp-packaging >/dev/null 2>&1`
end
def is_base_branch_valid?(branch)
@ -480,8 +483,10 @@ if $PROGRAM_NAME == __FILE__
attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}-v#{version}.tar.gz"]
attach_assets_to_release res['upload_url'], res['id'], ["#{base_dir}/dist/#{DEB_PKG_NAME}_#{version}_all.deb"]
puts 'Publishing release...'
publish_release res['id']
if PUBLISH
puts 'Publishing release...'
publish_release res['id']
end
puts 'Cleaning up...'
clean_up version
@ -489,6 +494,10 @@ if $PROGRAM_NAME == __FILE__
puts "Updating #{GH_STABLE_BRANCH} branch..."
update_stable_branch
if !PUBLISH
puts 'Release left in a "Draft" state. Go to the https://github.com/github/backup-utils/releases and publish when ready.'
end
puts 'Released!'
rescue RuntimeError => e
$stderr.puts "Error: #{e}"