diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e2b8bb4..bc61863 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,6 +1,7 @@
name: Test
on:
+ workflow_dispatch: {}
push:
jobs:
diff --git a/Gemfile b/Gemfile
index fc7fa4a..fa11f08 100644
--- a/Gemfile
+++ b/Gemfile
@@ -21,6 +21,11 @@ gem 'rubocop-require_tools'
# SimpleCov is a code coverage analysis tool for Ruby.
gem 'simplecov'
+# Dependencies no longer included in newer Ruby versions
+gem 'abbrev'
+gem 'logger'
+gem 'mutex_m'
+
gemspec
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
diff --git a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb
index 6527491..c06c1d0 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb
+++ b/lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb
@@ -44,7 +44,7 @@ def self.run(params)
UI.user_error!("No release task found for version #{latest_marketing_version}") unless release_task_id
release_task_url = Helper::AsanaHelper.asana_task_url(release_task_id)
- release_branch = "release/#{latest_marketing_version}"
+ release_branch = Helper::DdgAppleAutomationHelper.release_branch_name(platform, latest_marketing_version)
UI.success("Found #{latest_marketing_version} release task: #{release_task_url}")
Helper::GitHubActionsHelper.set_output("release_branch", release_branch)
diff --git a/lib/fastlane/plugin/ddg_apple_automation/actions/tag_release_action.rb b/lib/fastlane/plugin/ddg_apple_automation/actions/tag_release_action.rb
index f18796b..17ad141 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/actions/tag_release_action.rb
+++ b/lib/fastlane/plugin/ddg_apple_automation/actions/tag_release_action.rb
@@ -28,11 +28,11 @@ def self.setup_constants(platform)
end
def self.run(params)
- other_action.ensure_git_branch(branch: "^(:?release|hotfix)/.+$")
+ platform = params[:platform] || Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
+ other_action.ensure_git_branch(branch: "^(release|hotfix)/#{platform}/.+$")
Helper::GitHelper.setup_git_user
- params[:platform] ||= Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
- setup_constants(params[:platform])
+ setup_constants(platform)
tag_and_release_output = create_tag_and_github_release(params[:is_prerelease], params[:github_token])
Helper::GitHubActionsHelper.set_output("tag", tag_and_release_output[:tag])
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete-with-tasks.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete-with-tasks.html.erb
index d03e051..47f8090 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete-with-tasks.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete-with-tasks.html.erb
@@ -1,8 +1,8 @@
- Build <%= tag %> is now available for internal testing through Sparkle and TestFlight.
+ Build <%= tag %> is now available for internal testing through <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>Sparkle and<% end %> TestFlight.
Added in this release:
<%= tasks_since_last_internal_release %>
- 📥 DMG download link
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>📥 DMG download link<% end %>
\ No newline at end of file
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete.html.erb
index 9055d2a..8640c21 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-complete.html.erb
@@ -1,5 +1,4 @@
- Build <%= tag %> is now available for internal testing through Sparkle and TestFlight.
-
- 📥 DMG download link
+ Build <%= tag %> is now available for internal testing through <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>Sparkle and<% end %> TestFlight.
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>
📥 DMG download link<% end %>
\ No newline at end of file
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-merge-failed.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-merge-failed.html.erb
index 52de680..1a82f27 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-merge-failed.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-merge-failed.html.erb
@@ -1,7 +1,7 @@
[ACTION NEEDED] Internal release build <%= tag %> ready
- - 📥 DMG is available from <%= dmg_url %>.
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>- 📥 DMG is available from <%= dmg_url %>.
<% end %>
- 🏷️ Repository is tagged with
<%= tag %>
tag.
- 🚢 GitHub <%= tag %> pre-release is created.
- ❗️ Merging
<%= branch %>
to <%= base_branch %>
failed.
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-tag-failed.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-tag-failed.html.erb
index 4ebf597..b17bd7e 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-tag-failed.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready-tag-failed.html.erb
@@ -1,7 +1,7 @@
[ACTION NEEDED] Internal release build <%= tag %> ready
- - 📥 DMG is available from <%= dmg_url %>.
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>- 📥 DMG is available from <%= dmg_url %>.
<% end %>
- ❗️ Tagging repository failed.
- ⚠️ GitHub release creation was skipped.
- ⚠️ Merging
<%= branch %>
to <%= base_branch %>
was skipped.
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready.html.erb
index 3dc4489..f447cb7 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/internal-release-ready.html.erb
@@ -1,12 +1,12 @@
Internal release build <%= tag %> ready ✅
- - 📥 DMG is available from <%= dmg_url %>.
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>
- 📥 DMG is available from <%= dmg_url %>.
- If this is a subsequent internal release (started by calling Bump Internal Release workflow), the
DMG will be automatically published to Sparkle in a few minutes. Sit tight.
-
+
<% end %>
- 🏷️ Repository is tagged with
<%= tag %>
tag.
- 🚢 GitHub <%= tag %> pre-release is created.
- 🔱
<%= branch %>
branch has been successfully merged to <%= base_branch %>
.
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-complete-ios.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-complete-ios.html.erb
new file mode 100644
index 0000000..a5167dc
--- /dev/null
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-complete-ios.html.erb
@@ -0,0 +1,3 @@
+
+ Build <%= tag %> is now available publicly via App Store.
+
\ No newline at end of file
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-tagged.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-tagged.html.erb
index a832d22..cd89138 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-tagged.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/asana_add_comment/templates/public-release-tagged.html.erb
@@ -1,11 +1,11 @@
Public release <%= tag %> has been tagged ✅
- - 📥 DMG is available from <%= dmg_url %>.
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>- 📥 DMG is available from <%= dmg_url %>.
<% end %>
- 🏷️ Repository is tagged with
<%= tag %>
tag.
- 🚢 GitHub <%= tag %> release is created.
- 🔱
<%= branch %>
branch has been deleted.
- - 🚀 The relase will be published to Sparkle in a few minutes (you'll get notified).
+ <% if defined?(dmg_url) && !dmg_url.to_s.strip.empty? %>- 🚀 The relase will be published to Sparkle in a few minutes (you'll get notified).
<% end %>
🔗 Workflow URL: <%= workflow_url %>.
diff --git a/lib/fastlane/plugin/ddg_apple_automation/assets/release_task_helper/templates/release_announcement_task_description.html.erb b/lib/fastlane/plugin/ddg_apple_automation/assets/release_task_helper/templates/release_announcement_task_description.html.erb
index 08d2c47..0456793 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/assets/release_task_helper/templates/release_announcement_task_description.html.erb
+++ b/lib/fastlane/plugin/ddg_apple_automation/assets/release_task_helper/templates/release_announcement_task_description.html.erb
@@ -1,7 +1,7 @@
As the last step of the process, post a message to REVIEW / RELEASE Asana project:
- - Set the title to macOS App Release <%= marketing_version %>
+ - Set the title to <%= platform == "ios" ? "iOS App Release" : "macOS App Release" %> <%= marketing_version %>
- Copy the content below (between separators) and paste as the message body.
@@ -14,8 +14,12 @@
<% end %>
Rollout
- This is now rolling out to users. New users will receive this release immediately,
+ <% if platform == "ios" %>This is now rolling out to users. New users will receive this release immediately,
+ existing users will receive this gradually over the next few days until we reach a 5% threshold.
+ If there are no problems we will push the release to everyone.
+ You can force an update now by going to the App Store, finding the Update tab and downloading the latest version.
+ <% else %>This is now rolling out to users. New users will receive this release immediately,
existing users will receive this gradually over the next few days. You can force an update now
- by going to the DuckDuckGo menu in the menu bar and selecting "Check For Updates".
+ by going to the DuckDuckGo menu in the menu bar and selecting "Check For Updates".<% end %>
diff --git a/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb b/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb
index f7f33ee..350279b 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb
+++ b/lib/fastlane/plugin/ddg_apple_automation/helper/asana_helper.rb
@@ -18,8 +18,8 @@ class AsanaHelper # rubocop:disable Metrics/ClassLength
ASANA_TASK_URL_REGEX = %r{https://app.asana.com/[0-9]/[0-9]+/([0-9]+)(:/f)?}
ASANA_WORKSPACE_ID = "137249556945"
- IOS_HOTFIX_TASK_TEMPLATE_ID = "1205352950253153"
- IOS_RELEASE_TASK_TEMPLATE_ID = "1205355281110338"
+ IOS_HOTFIX_TASK_TEMPLATE_ID = "1209242676101485"
+ IOS_RELEASE_TASK_TEMPLATE_ID = "1209175074761732"
MACOS_HOTFIX_TASK_TEMPLATE_ID = "1206724592377782"
MACOS_RELEASE_TASK_TEMPLATE_ID = "1206127427850447"
@@ -293,7 +293,7 @@ def self.update_asana_tasks_for_public_release(params)
# Construct release announcement task description
UI.message("Preparing release announcement task")
- Helper::ReleaseTaskHelper.construct_release_announcement_task_description(params[:version], release_notes, task_ids)
+ Helper::ReleaseTaskHelper.construct_release_announcement_task_description(params[:version], release_notes, task_ids, params[:platform])
end
def self.fetch_tasks_for_tag(tag_id, asana_access_token)
diff --git a/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb b/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb
index 070eae5..f78f3fa 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb
+++ b/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb
@@ -36,6 +36,14 @@ class DdgAppleAutomationHelper
])
}.freeze
+ def self.release_branch_name(platform, version)
+ "#{RELEASE_BRANCH}/#{platform}/#{version}"
+ end
+
+ def self.hotfix_branch_name(platform, version)
+ "#{HOTFIX_BRANCH}/#{platform}/#{version}"
+ end
+
def self.code_freeze_prechecks(other_action)
other_action.ensure_git_status_clean
other_action.ensure_git_branch(branch: DEFAULT_BRANCH)
@@ -131,11 +139,16 @@ def self.extract_version_from_tag(tag)
def self.prepare_release_branch(platform, version, other_action)
code_freeze_prechecks(other_action) unless Helper.is_ci?
new_version = validate_new_version(version)
- create_release_branch(new_version)
+ create_release_branch(platform, new_version)
update_embedded_files(platform, other_action)
- update_version_config(new_version, other_action)
+ if platform == "ios"
+ # Any time we prepare a release branch for iOS the the build number should be reset to 0
+ update_version_and_build_number_config(new_version, 0, other_action)
+ else
+ update_version_config(new_version, other_action)
+ end
other_action.push_to_git_remote
- release_branch_name = "#{RELEASE_BRANCH}/#{new_version}"
+ release_branch_name = release_branch_name(platform, new_version)
Helper::GitHubActionsHelper.set_output("release_branch_name", release_branch_name)
return release_branch_name, new_version
@@ -150,16 +163,20 @@ def self.prepare_hotfix_branch(github_token, platform, other_action, options)
source_version = validate_version_exists(version)
new_version = validate_hotfix_version(source_version)
release_branch_name = create_hotfix_branch(platform, source_version, new_version)
- update_version_config(new_version, other_action)
+ if platform == "ios"
+ update_version_and_build_number_config(new_version, 0, other_action)
+ else
+ update_version_config(new_version, other_action)
+ end
other_action.push_to_git_remote
- increment_build_number(platform, options, other_action)
+ increment_build_number(platform, options, other_action) if platform == "macos"
Helper::GitHubActionsHelper.set_output("release_branch_name", release_branch_name)
return release_branch_name, new_version
end
def self.create_hotfix_branch(platform, source_version, new_version)
- branch_name = "#{HOTFIX_BRANCH}/#{new_version}"
+ branch_name = hotfix_branch_name(platform, new_version)
UI.message("Creating new hotfix release branch for #{new_version}")
existing_branch = Actions.sh("git", "branch", "--list", branch_name).strip
@@ -193,9 +210,9 @@ def self.validate_version_exists(version)
existing_tag
end
- def self.create_release_branch(version)
+ def self.create_release_branch(platform, version)
UI.message("Creating new release branch for #{version}")
- release_branch = "#{RELEASE_BRANCH}/#{version}"
+ release_branch = release_branch_name(platform, version)
# Abort if the branch already exists
UI.abort_with_message!("Branch #{release_branch} already exists in this repository. Aborting.") unless Actions.sh(
diff --git a/lib/fastlane/plugin/ddg_apple_automation/helper/release_task_helper.rb b/lib/fastlane/plugin/ddg_apple_automation/helper/release_task_helper.rb
index a369cb0..2ea7ec9 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/helper/release_task_helper.rb
+++ b/lib/fastlane/plugin/ddg_apple_automation/helper/release_task_helper.rb
@@ -18,12 +18,13 @@ def self.construct_release_task_description(release_notes, task_ids)
Helper::AsanaHelper.sanitize_asana_html_notes(html_notes)
end
- def self.construct_release_announcement_task_description(version, release_notes, task_ids)
+ def self.construct_release_announcement_task_description(version, release_notes, task_ids, platform)
template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("release_task_helper/templates/release_announcement_task_description.html.erb")
html_notes = Helper::DdgAppleAutomationHelper.process_erb_template(template_file, {
marketing_version: version,
release_notes: release_notes,
- task_ids: task_ids
+ task_ids: task_ids,
+ platform: platform
})
Helper::AsanaHelper.sanitize_asana_html_notes(html_notes)
end
diff --git a/lib/fastlane/plugin/ddg_apple_automation/version.rb b/lib/fastlane/plugin/ddg_apple_automation/version.rb
index 1bfdfec..8c74969 100644
--- a/lib/fastlane/plugin/ddg_apple_automation/version.rb
+++ b/lib/fastlane/plugin/ddg_apple_automation/version.rb
@@ -1,5 +1,5 @@
module Fastlane
module DdgAppleAutomation
- VERSION = "0.12.1"
+ VERSION = "1.0.3"
end
end
diff --git a/spec/asana_add_comment_action_spec.rb b/spec/asana_add_comment_action_spec.rb
index 2eea75b..a9eb6f8 100644
--- a/spec/asana_add_comment_action_spec.rb
+++ b/spec/asana_add_comment_action_spec.rb
@@ -214,8 +214,7 @@ def test_action(task_id: nil, task_url: nil, comment: nil, template_name: nil, w
expected = <<~EXPECTED
Build 1.0.0-123 is now available for internal testing through Sparkle and TestFlight.
-
- 📥 DMG download link
+
📥 DMG download link
EXPECTED
diff --git a/spec/asana_find_release_task_action_spec.rb b/spec/asana_find_release_task_action_spec.rb
index ecc53a3..ba5b713 100644
--- a/spec/asana_find_release_task_action_spec.rb
+++ b/spec/asana_find_release_task_action_spec.rb
@@ -13,11 +13,11 @@
expect(test_action("ios")).to eq({
release_task_id: "1234567890",
release_task_url: "https://app.asana.com/0/0/1234567890/f",
- release_branch: "release/1.0.0"
+ release_branch: "release/ios/1.0.0"
})
expect(Fastlane::UI).to have_received(:success).with("Found 1.0.0 release task: https://app.asana.com/0/0/1234567890/f")
- expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("release_branch", "release/1.0.0")
+ expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("release_branch", "release/ios/1.0.0")
expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("release_task_id", "1234567890")
expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("release_task_url", "https://app.asana.com/0/0/1234567890/f")
end
diff --git a/spec/asana_helper_spec.rb b/spec/asana_helper_spec.rb
index 8b8a397..6557b6a 100644
--- a/spec/asana_helper_spec.rb
+++ b/spec/asana_helper_spec.rb
@@ -394,7 +394,7 @@ def sanitize_asana_html_notes(content)
expect(Fastlane::Helper::AsanaHelper).to receive(:move_tasks_to_section).with(task_ids, params[:target_section_id], params[:asana_access_token])
expect(Fastlane::Helper::AsanaHelper).to receive(:complete_tasks).with(task_ids, params[:asana_access_token])
expect(Fastlane::Helper::AsanaHelper).to receive(:fetch_release_notes).with(params[:release_task_id], params[:asana_access_token])
- expect(Fastlane::Helper::ReleaseTaskHelper).to receive(:construct_release_announcement_task_description).with(params[:version], release_notes, task_ids - [params[:release_task_id]])
+ expect(Fastlane::Helper::ReleaseTaskHelper).to receive(:construct_release_announcement_task_description).with(params[:version], release_notes, task_ids - [params[:release_task_id]], "ios")
Fastlane::Helper::AsanaHelper.update_asana_tasks_for_public_release(params)
expect(Fastlane::UI).to have_received(:message).with("Fetching #{tag_name} Asana tag")
diff --git a/spec/ddg_apple_automation_helper_spec.rb b/spec/ddg_apple_automation_helper_spec.rb
index 6396ba1..2853424 100644
--- a/spec/ddg_apple_automation_helper_spec.rb
+++ b/spec/ddg_apple_automation_helper_spec.rb
@@ -125,15 +125,16 @@ def load_file(file)
allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:update_embedded_files)
allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:update_version_config)
expect(other_action).to receive(:push_to_git_remote)
+ platform = "macos"
release_branch, new_version = Fastlane::Helper::DdgAppleAutomationHelper.prepare_release_branch(platform, version, other_action)
- expect(release_branch).to eq("#{Fastlane::Helper::DdgAppleAutomationHelper::RELEASE_BRANCH}/#{version}")
+ expect(release_branch).to eq("#{Fastlane::Helper::DdgAppleAutomationHelper::RELEASE_BRANCH}/#{platform}/#{version}")
expect(new_version).to eq(version)
end
end
describe "#create_hotfix_branch" do
it "creates a new hotfix branch and checks out the branch" do
- branch_name = "hotfix/1.0.1"
+ branch_name = "hotfix/macos/1.0.1"
source_version = "1.0.0"
new_version = "1.0.1"
platform = "macos"
@@ -149,13 +150,13 @@ def load_file(file)
end
it "raises an error when the branch already exists" do
- allow(Fastlane::Actions).to receive(:sh).with("git", "branch", "--list", "hotfix/1.0.1").and_return("hotfix/1.0.1")
+ allow(Fastlane::Actions).to receive(:sh).with("git", "branch", "--list", "hotfix/macos/1.0.1").and_return("hotfix/macos/1.0.1")
source_version = "1.0.0"
new_version = "1.0.1"
platform = "macos"
expect do
Fastlane::Helper::DdgAppleAutomationHelper.create_hotfix_branch(platform, source_version, new_version)
- end.to raise_error(FastlaneCore::Interface::FastlaneCommonException, "Branch hotfix/1.0.1 already exists in this repository. Aborting.")
+ end.to raise_error(FastlaneCore::Interface::FastlaneCommonException, "Branch hotfix/macos/1.0.1 already exists in this repository. Aborting.")
end
end
@@ -186,7 +187,7 @@ def load_file(file)
end
describe "#prepare_hotfix_branch" do
- it "prepares the hotfix branch" do
+ it "prepares the hotfix branch for macos" do
platform = "macos"
version = "1.0.0"
source_version = "1.0.0"
@@ -235,15 +236,62 @@ def load_file(file)
expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("last_release", source_version)
expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("release_branch_name", release_branch_name)
end
+
+ it "prepares the hotfix branch for ios" do
+ platform = "ios"
+ version = "1.0.0"
+ source_version = "1.0.0"
+ new_version = "1.0.1"
+ release_branch_name = "hotfix/1.0.1"
+ other_action = double("other_action")
+ options = { some_option: "value" }
+ github_token = "github-token"
+
+ @client = double("Octokit::Client")
+ allow(Octokit::Client).to receive(:new).and_return(@client)
+ allow(@client).to receive(:latest_release).and_return(double(tag_name: source_version))
+ allow(Fastlane::Helper::GitHelper).to receive(:repo_name).and_return("iOS")
+
+ allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:validate_version_exists)
+ .with(version).and_return(source_version)
+
+ allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:validate_hotfix_version)
+ .with(source_version).and_return(new_version)
+
+ allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:create_hotfix_branch)
+ .with(platform, source_version, new_version).and_return(release_branch_name)
+
+ allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:update_version_and_build_number_config)
+ .with(new_version, 0, other_action)
+
+ allow(Fastlane::Helper::GitHubActionsHelper).to receive(:set_output)
+
+ expect(other_action).to receive(:push_to_git_remote)
+
+ result_branch, result_version = Fastlane::Helper::DdgAppleAutomationHelper.prepare_hotfix_branch(
+ github_token, platform, other_action, options
+ )
+
+ expect(result_branch).to eq(release_branch_name)
+ expect(result_version).to eq(new_version)
+
+ expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:validate_version_exists).with(version)
+ expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:validate_hotfix_version).with(source_version)
+ expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:create_hotfix_branch).with(platform, source_version, new_version)
+ expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:update_version_and_build_number_config).with(new_version, 0, other_action)
+ expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("last_release", source_version)
+ expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("release_branch_name", release_branch_name)
+ end
end
describe "#create_release_branch" do
it "creates a new release branch" do
+ platform = "macos"
allow(Fastlane::Actions).to receive(:sh).and_return("")
- Fastlane::Helper::DdgAppleAutomationHelper.create_release_branch(version)
- expect(Fastlane::Actions).to have_received(:sh).with("git", "branch", "--list", "release/#{version}")
- expect(Fastlane::Actions).to have_received(:sh).with("git", "checkout", "-b", "release/#{version}")
- expect(Fastlane::Actions).to have_received(:sh).with("git", "push", "-u", "origin", "release/#{version}")
+ Fastlane::Helper::DdgAppleAutomationHelper.create_release_branch(platform, version)
+ expect(Fastlane::Actions).to have_received(:sh).with("git", "branch", "--list", "release/#{platform}/#{version}")
+ expect(Fastlane::Actions).to have_received(:sh).with("git", "checkout", "-b", "release/#{platform}/#{version}")
+ expect(Fastlane::Actions).to have_received(:sh).with("git", "push", "-u", "origin", "release/#{platform}/#{version}")
end
end
diff --git a/spec/release_task_helper_spec.rb b/spec/release_task_helper_spec.rb
index ec0bae5..8057408 100644
--- a/spec/release_task_helper_spec.rb
+++ b/spec/release_task_helper_spec.rb
@@ -54,6 +54,7 @@ def construct_release_task_description(release_notes, task_ids)
describe "#construct_release_announcement_task_description" do
let (:template_file) { "template.html.erb" }
let (:version) { "1.0.0" }
+ let (:platform) { "macos" }
let (:release_notes) { "- Release note 1
- Release note 2
- Release note 3
" }
let (:task_ids) { ["1", "2", "3"] }
@@ -63,13 +64,14 @@ def construct_release_task_description(release_notes, task_ids)
allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:process_erb_template).and_return(html_notes)
allow(Fastlane::Helper::AsanaHelper).to receive(:sanitize_asana_html_notes).and_call_original
- expect(construct_release_announcement_task_description(version, release_notes, task_ids)).to eq(html_notes)
+ expect(construct_release_announcement_task_description(version, release_notes, task_ids, platform)).to eq(html_notes)
expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:path_for_asset_file).with("release_task_helper/templates/release_announcement_task_description.html.erb")
expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:process_erb_template).with(template_file, {
marketing_version: version,
release_notes: release_notes,
- task_ids: task_ids
+ task_ids: task_ids,
+ platform: platform
})
expect(Fastlane::Helper::AsanaHelper).to have_received(:sanitize_asana_html_notes).with(html_notes)
end
@@ -106,11 +108,78 @@ def construct_release_task_description(release_notes, task_ids)
EXPECTED
- expect(construct_release_announcement_task_description(version, release_notes, task_ids)).to eq(expected)
+ expect(construct_release_announcement_task_description(version, release_notes, task_ids, platform)).to eq(expected)
+ end
+
+ def construct_release_announcement_task_description(version, release_notes, task_ids, platform)
+ Fastlane::Helper::ReleaseTaskHelper.construct_release_announcement_task_description(version, release_notes, task_ids, platform)
+ end
+ end
+
+ describe "#construct_release_announcement_task_description for ios" do
+ let (:template_file) { "template.html.erb" }
+ let (:version) { "1.0.0" }
+ let (:platform) { "ios" }
+ let (:release_notes) { "- Release note 1
- Release note 2
- Release note 3
" }
+ let (:task_ids) { ["1", "2", "3"] }
+
+ it "constructs release announcement task description" do
+ html_notes = "Hello
"
+ allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:path_for_asset_file).and_return(template_file)
+ allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:process_erb_template).and_return(html_notes)
+ allow(Fastlane::Helper::AsanaHelper).to receive(:sanitize_asana_html_notes).and_call_original
+
+ expect(construct_release_announcement_task_description(version, release_notes, task_ids, platform)).to eq(html_notes)
+
+ expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:path_for_asset_file).with("release_task_helper/templates/release_announcement_task_description.html.erb")
+ expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:process_erb_template).with(template_file, {
+ marketing_version: version,
+ release_notes: release_notes,
+ task_ids: task_ids,
+ platform: platform
+ })
+ expect(Fastlane::Helper::AsanaHelper).to have_received(:sanitize_asana_html_notes).with(html_notes)
+ end
+
+ it "correctly processes the template" do
+ allow(Fastlane::Helper::AsanaHelper).to receive(:sanitize_asana_html_notes) do |html_notes|
+ html_notes
+ end
+
+ expected = <<~EXPECTED
+
+ As the last step of the process, post a message to REVIEW / RELEASE Asana project:
+
+ - Set the title to iOS App Release 1.0.0
+ - Copy the content below (between separators) and paste as the message body.
+
+
+ Release notes
+ - Release note 1
- Release note 2
- Release note 3
+ This release includes:
+
+ #{' '}
+
+ #{' '}
+
+ #{' '}
+
+ #{' '}
+
+ Rollout
+ This is now rolling out to users. New users will receive this release immediately,#{' '}
+ existing users will receive this gradually over the next few days until we reach a 5% threshold.#{' '}
+ If there are no problems we will push the release to everyone.#{' '}
+ You can force an update now by going to the App Store, finding the Update tab and downloading the latest version.
+ #{' '}
+
+
+ EXPECTED
+ expect(construct_release_announcement_task_description(version, release_notes, task_ids, platform)).to eq(expected)
end
- def construct_release_announcement_task_description(version, release_notes, task_ids)
- Fastlane::Helper::ReleaseTaskHelper.construct_release_announcement_task_description(version, release_notes, task_ids)
+ def construct_release_announcement_task_description(version, release_notes, task_ids, platform)
+ Fastlane::Helper::ReleaseTaskHelper.construct_release_announcement_task_description(version, release_notes, task_ids, platform)
end
end