|
|
|
|
@@ -7,7 +7,7 @@ require 'json'
|
|
|
|
|
|
|
|
|
|
namespace :release do
|
|
|
|
|
desc 'Create a new release'
|
|
|
|
|
task :new => [:check_versions, :check_tag_and_ask_to_release, 'spm:test', :github, :cocoapods]
|
|
|
|
|
task :new => [:check_versions, :check_tag_and_ask_to_release, 'spm:test', :github]
|
|
|
|
|
|
|
|
|
|
desc 'Check if all versions from the podspecs and CHANGELOG match'
|
|
|
|
|
task :check_versions do
|
|
|
|
|
@@ -15,7 +15,7 @@ namespace :release do
|
|
|
|
|
|
|
|
|
|
Utils.table_header('Check', 'Status')
|
|
|
|
|
|
|
|
|
|
# Check if bundler is installed first, as we'll need it for the cocoapods task (and we prefer to fail early)
|
|
|
|
|
# Check if bundler is installed first (we prefer to fail early)
|
|
|
|
|
`which bundler`
|
|
|
|
|
results << Utils.table_result(
|
|
|
|
|
$CHILD_STATUS.success?,
|
|
|
|
|
@@ -40,18 +40,14 @@ namespace :release do
|
|
|
|
|
|
|
|
|
|
# Check docs installation
|
|
|
|
|
docs_package = Utils.first_match_in_file('docs/installation.rst', /\.package\(url: .+ from: "(.+)"/, 1)
|
|
|
|
|
docs_cocoapods = Utils.first_match_in_file('docs/installation.rst', /pod 'Stencil', '~> (.+)'/, 1)
|
|
|
|
|
docs_carthage = Utils.first_match_in_file('docs/installation.rst', /github ".+\/Stencil" ~> (.+)/, 1)
|
|
|
|
|
results << Utils.table_result(docs_package == v, 'Docs, package updated', 'Update the package version in docs/installation.rst')
|
|
|
|
|
results << Utils.table_result(docs_cocoapods == v, 'Docs, cocoapods updated', 'Update the cocoapods version in docs/installation.rst')
|
|
|
|
|
results << Utils.table_result(docs_carthage == v, 'Docs, carthage updated', 'Update the carthage version in docs/installation.rst')
|
|
|
|
|
|
|
|
|
|
# Check if entry present in CHANGELOG
|
|
|
|
|
changelog_entry = Utils.first_match_in_file('CHANGELOG.md', /^## #{Regexp.quote(v)}$/)
|
|
|
|
|
results << Utils.table_result(changelog_entry, 'CHANGELOG, Entry added', "Add an entry for #{v} in CHANGELOG.md")
|
|
|
|
|
|
|
|
|
|
changelog_has_stable = system("grep -qi '^## Master' CHANGELOG.md")
|
|
|
|
|
results << Utils.table_result(!changelog_has_stable, 'CHANGELOG, No master', 'Remove section for master branch in CHANGELOG')
|
|
|
|
|
results << Utils.table_result(!changelog_has_stable, 'CHANGELOG, No master', 'Remove section for main branch in CHANGELOG')
|
|
|
|
|
|
|
|
|
|
exit 1 unless results.all?
|
|
|
|
|
end
|
|
|
|
|
@@ -82,16 +78,10 @@ namespace :release do
|
|
|
|
|
tag = Utils.top_changelog_version
|
|
|
|
|
body = Utils.top_changelog_entry
|
|
|
|
|
|
|
|
|
|
raise 'Must be a valid version' if tag == 'Master'
|
|
|
|
|
raise 'Must be a valid version' if tag == 'main'
|
|
|
|
|
|
|
|
|
|
repo_name = File.basename(`git remote get-url origin`.chomp, '.git').freeze
|
|
|
|
|
puts "Pushing release notes for tag #{tag}"
|
|
|
|
|
client.create_release("stencilproject/#{repo_name}", tag, name: tag, body: body)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "pod trunk push #{POD_NAME} to CocoaPods"
|
|
|
|
|
task :cocoapods do
|
|
|
|
|
Utils.print_header 'Pushing pod to CocoaPods Trunk'
|
|
|
|
|
sh "bundle exec pod trunk push #{POD_NAME}.podspec.json"
|
|
|
|
|
client.create_release("swiftstencil/#{repo_name}", tag, name: tag, body: body)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|