-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Update the release procedure #19
Draft
ekohl
wants to merge
4
commits into
voxpupuli:master
Choose a base branch
from
ekohl:release-prep
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,57 @@ | ||
require 'github_changelog_generator/task' | ||
|
||
desc 'Prepare a new release' | ||
task :prepare_release, [:version] do |t, args| | ||
unless args[:version] | ||
puts 'you need to provide a version like: rake prepare_release[1.0.0]' | ||
exit | ||
end | ||
|
||
version = args[:version] | ||
if ['major', 'minor', 'patch'].include?(version) | ||
bump_task = "module:bump:#{version}" | ||
elsif /^\d+\.\d+\.\d+$/.match(version) | ||
bump_task = 'module:bump:full' | ||
ENV['BLACKSMITH_FULL_VERSION'] = version | ||
else | ||
puts 'Version needs to be major, minor, patch or in the X.X.X format' | ||
exit | ||
end | ||
|
||
Rake::Task[bump_task].invoke | ||
Rake::Task['changelog'].invoke | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work. The future version is read when the Rakefile is loaded, then bumped at runtime but not re-read. |
||
end | ||
|
||
desc 'release new version through Travis-ci' | ||
task "travis_release" do | ||
task "travis_release" => [:check_version, :check_changelog, 'module:clean'] do | ||
|
||
require 'puppet_blacksmith/rake_tasks' | ||
Blacksmith::RakeTask.new do |t| | ||
t.build = false # do not build the module nor push it to the Forge | ||
# just do the tagging [:clean, :tag, :bump_commit] | ||
t.tag_message_pattern = "Version %s" # Use annotated commits | ||
end | ||
|
||
m = Blacksmith::Modulefile.new | ||
v = m.version | ||
raise "Refusing to release an RC or build-release (#{v}).\n" + | ||
"Please set a semver *release* version." unless v =~ /^\d+\.\d+.\d+$/ | ||
|
||
Rake::Task[:check_changelog].invoke | ||
# do a "manual" module:release (clean, tag, bump, commit, push tags) | ||
Rake::Task["module:clean"].invoke | ||
|
||
# idempotently create tags | ||
m = Blacksmith::Modulefile.new | ||
g = Blacksmith::Git.new | ||
Rake::Task["module:tag"].invoke unless g.has_version_tag?(v) | ||
Rake::Task["module:tag"].invoke unless g.has_version_tag?(m.version) | ||
|
||
v_inc = m.increase_version(v) | ||
v_new = "#{v_inc}-rc0" | ||
# Bump to the next version as rc0 | ||
v_new = "#{m.increase_version(m.version)}-rc0" | ||
ENV['BLACKSMITH_FULL_VERSION'] = v_new | ||
Rake::Task["module:bump:full"].invoke | ||
Rake::Task["module:bump_commit:full"].invoke | ||
|
||
# push it out, and let travis do the release: | ||
g.commit_modulefile!(v_new) | ||
g.push! | ||
end | ||
|
||
desc 'Check if the version is a semver release version' | ||
task :check_version do | ||
m = Blacksmith::Modulefile.new | ||
v = m.version | ||
fail "Refusing to release an RC or build-release (#{v}).\n" + | ||
"Please set a semver *release* version." unless v =~ /^\d+\.\d+.\d+$/ | ||
end | ||
|
||
desc 'Check Changelog.' | ||
task :check_changelog do | ||
v = Blacksmith::Modulefile.new.version | ||
|
@@ -42,3 +63,12 @@ | |
fail "Unable to find a CHANGELOG.md entry for the #{v} release." | ||
end | ||
end | ||
|
||
GitHubChangelogGenerator::RakeTask.new :changelog do |config| | ||
modulefile = Blacksmith::Modulefile.new | ||
config.user = 'voxpupuli' | ||
config.project = modulefile.name | ||
config.future_release = "v#{modulefile.version}" if modulefile.version =~ /^\d+\.\d+.\d+$/ | ||
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." | ||
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch will need special treatment:
Bumping version from 2.0.1-rc0 to 2.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about allowing users to specify a specific version as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be supported in the
elsif
clauseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
voxpupuli/puppet-blacksmith#62 should handle the bumping issue.