Skip to content

Commit

Permalink
Add process_erb_template in DdgAppleAutomationHelper and improve pars…
Browse files Browse the repository at this point in the history
…ing ERB templates
  • Loading branch information
ayoy committed Sep 15, 2024
1 parent 8862efb commit 9d1a394
Show file tree
Hide file tree
Showing 34 changed files with 189 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ def self.run(params)

def self.process_template(template_name, args)
template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("asana_add_comment/templates/#{template_name}.html.erb")
template_content = Helper::DdgAppleAutomationHelper.load_file(template_file)
return unless template_content

erb_template = ERB.new(template_content)
erb_template.result(binding)
Helper::DdgAppleAutomationHelper.process_erb_template(template_file, args)
end

def self.description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,8 @@ def self.fetch_assignee_id(task_id:, github_handle:, asana_access_token:, is_sch

def self.process_yaml_template(template_name, args)
template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("asana_create_action_item/templates/#{template_name}.yml.erb")
template_content = Helper::DdgAppleAutomationHelper.load_file(template_file)

erb_template = ERB.new(template_content)
yaml = erb_template.result(binding)

yaml = Helper::DdgAppleAutomationHelper.process_erb_template(template_file, args)
task_data = YAML.safe_load(yaml)

return task_data["name"], task_data["html_notes"]
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<body>
<h2>[ACTION NEEDED] Publishing <%= args['tag'] %> hotfix release to Sparkle failed</h2>
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with generating appcast2.xml and uploading files to S3 from your
local machine, <a data-asana-gid='<%= args['task_id'] %>' data-asana-dynamic='false'>according to instructions</a>.<br>
<h2>[ACTION NEEDED] Publishing <%= tag %> hotfix release to Sparkle failed</h2>
<a data-asana-gid='<%= assignee_id %>' />, please proceed with generating appcast2.xml and uploading files to S3 from your
local machine, <a data-asana-gid='<%= task_id %>' data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<body>
<h2>[ACTION NEEDED] Publishing <%= args['tag'] %> internal release to Sparkle failed</h2>
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with generating appcast2.xml and uploading files to S3 from your
local machine, <a data-asana-gid='<%= args['task_id'] %>' data-asana-dynamic='false'>according to instructions</a>.<br>
<h2>[ACTION NEEDED] Publishing <%= tag %> internal release to Sparkle failed</h2>
<a data-asana-gid='<%= assignee_id %>' />, please proceed with generating appcast2.xml and uploading files to S3 from your
local machine, <a data-asana-gid='<%= task_id %>' data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<body>
<h2>[ACTION NEEDED] Publishing <%= args['tag'] %> release to Sparkle failed</h2>
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with generating appcast2.xml and uploading files to S3 from your
local machine, <a data-asana-gid='<%= args['task_id'] %>' data-asana-dynamic='false'>according to instructions</a>.<br>
<h2>[ACTION NEEDED] Publishing <%= tag %> release to Sparkle failed</h2>
<a data-asana-gid='<%= assignee_id %>' />, please proceed with generating appcast2.xml and uploading files to S3 from your
local machine, <a data-asana-gid='<%= task_id %>' data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<body>
🐛 Debug symbols archive for <%= args['tag'] %> build is uploaded to <code><%= args['dsym_s3_path'] %></code>.<br>
🐛 Debug symbols archive for <%= tag %> build is uploaded to <code><%= dsym_s3_path %></code>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<body>
📥 DMG for <%= args['tag'] %> is available from <a href='<%= args['dmg_url'] %>'><%= args['dmg_url'] %></a>.<br>
📥 DMG for <%= tag %> is available from <a href='<%= dmg_url %>'><%= dmg_url %></a>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<body>
<h2>Hotfix branch <%= args['branch'] %> ready ⚙️</h2>
<h2>Hotfix branch <%= branch %> ready ⚙️</h2>
<ul>
<li>🔱 <code><%= args['branch'] %></code> branch has been created off <code><%= args['release_tag'] %></code> tag.</li>
<li>🔱 <code><%= branch %></code> branch has been created off <code><%= release_tag %></code> tag.</li>
<li>Point any pull requests with changes required for the hotfix release to that branch.</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<body>
Build <%= args['tag'] %> is now available for internal testing through Sparkle and TestFlight.<br>
Build <%= tag %> is now available for internal testing through Sparkle and TestFlight.<br>
<br>
Added in this release:
<%= args['tasks_since_last_internal_release'] %><br>
<%= tasks_since_last_internal_release %><br>
<br>
<a href='<%= args['dmg_url'] %>'>📥 DMG download link</a>
<a href='<%= dmg_url %>'>📥 DMG download link</a>
</body>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<body>
Build <%= args['tag'] %> is now available for internal testing through Sparkle and TestFlight.<br>
Build <%= tag %> is now available for internal testing through Sparkle and TestFlight.<br>
<br>
<a href='<%= args['dmg_url'] %>'>📥 DMG download link</a>
<a href='<%= dmg_url %>'>📥 DMG download link</a>
</body>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<body>
<h2>[ACTION NEEDED] Internal release build <%= args['tag'] %> ready</h2>
<h2>[ACTION NEEDED] Internal release build <%= tag %> ready</h2>
<ul>
<li>📥 DMG is available from <a href='<%= args['dmg_url'] %>'><%= args['dmg_url'] %></a>.</li>
<li>🏷️ Repository is tagged with <code><%= args['tag'] %></code> tag.</li>
<li>🚢 GitHub <a href='<%= args['release_url'] %>'><%= args['tag'] %> pre-release</a> is created.</li>
<li><b>❗️ Merging <code><%= args['branch'] %></code> to <code><%= args['base_branch'] %></code> failed.</b>
<li>📥 DMG is available from <a href='<%= dmg_url %>'><%= dmg_url %></a>.</li>
<li>🏷️ Repository is tagged with <code><%= tag %></code> tag.</li>
<li>🚢 GitHub <a href='<%= release_url %>'><%= tag %> pre-release</a> is created.</li>
<li><b>❗️ Merging <code><%= branch %></code> to <code><%= base_branch %></code> failed.</b>
<ul>
<li><a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with manual merging <a data-asana-gid='<%= args['task_id'] %>'
<li><a data-asana-gid='<%= assignee_id %>' />, please proceed with manual merging <a data-asana-gid='<%= task_id %>'
data-asana-dynamic='false'>according to instructions</a>.</li>
</ul>
</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<body>
<h2>[ACTION NEEDED] Internal release build <%= args['tag'] %> ready</h2>
<h2>[ACTION NEEDED] Internal release build <%= tag %> ready</h2>
<ul>
<li>📥 DMG is available from <a href='<%= args['dmg_url'] %>'><%= args['dmg_url'] %></a>.</li>
<li>📥 DMG is available from <a href='<%= dmg_url %>'><%= dmg_url %></a>.</li>
<li><b>❗️ Tagging repository failed.</b></li>
<li><b>⚠️ GitHub release creation was skipped.</b></li>
<li><b>⚠️ Merging <code><%= args['branch'] %></code> to <code><%= args['base_branch'] %></code> was skipped.</b></li>
<li><b>⚠️ Merging <code><%= branch %></code> to <code><%= base_branch %></code> was skipped.</b></li>
</ul>
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with manual tagging and merging <a data-asana-gid='<%= args['task_id'] %>'
<a data-asana-gid='<%= assignee_id %>' />, please proceed with manual tagging and merging <a data-asana-gid='<%= task_id %>'
data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<body>
<h2>Internal release build <%= args['tag'] %> ready ✅</h2>
<h2>Internal release build <%= tag %> ready ✅</h2>
<ul>
<li>📥 DMG is available from <a href='<%= args['dmg_url'] %>'><%= args['dmg_url'] %></a>.
<li>📥 DMG is available from <a href='<%= dmg_url %>'><%= dmg_url %></a>.
<ul>
<li>If this is a subsequent internal release (started by calling <em>Bump Internal Release</em> workflow), the
DMG will be automatically published to Sparkle in a few minutes. Sit tight.</li>
</ul>
</li>
<li>🏷️ Repository is tagged with <code><%= args['tag'] %></code> tag.</li>
<li>🚢 GitHub <a href='<%= args['release_url'] %>'><%= args['tag'] %> pre-release</a> is created.</li>
<li>🔱 <code><%= args['branch'] %></code> branch has been successfully merged to <code><%= args['base_branch'] %></code>.</li>
<li>🏷️ Repository is tagged with <code><%= tag %></code> tag.</li>
<li>🚢 GitHub <a href='<%= release_url %>'><%= tag %> pre-release</a> is created.</li>
<li>🔱 <code><%= branch %></code> branch has been successfully merged to <code><%= base_branch %></code>.</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<body>
Build <%= args['tag'] %> is now available publicly through Sparkle and TestFlight.<br>
Build <%= tag %> is now available publicly through Sparkle and TestFlight.<br>
<br>
<a href='<%= args['dmg_url'] %>'>📥 DMG download link</a>
<a href='<%= dmg_url %>'>📥 DMG download link</a>
</body>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<body>
<h2>[ACTION NEEDED] Failed to publish <%= args['tag'] %> release – tagging failed</h2>
<h2>[ACTION NEEDED] Failed to publish <%= tag %> release – tagging failed</h2>
<ul>
<li><b>❗️ Tagging repository with <%= args['tag'] %> tag failed.</b></li>
<li><b>❗️ Tagging repository with <%= tag %> tag failed.</b></li>
<li><b>⚠️ GitHub release creation was skipped.</b></li>
<li><b>⚠️ Deleting <code><%= args['branch'] %></code> was skipped.</b></li>
<li><b>⚠️ Deleting <code><%= branch %></code> was skipped.</b></li>
</ul>
<br>
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with the release <a data-asana-gid='<%= args['task_id'] %>'
<a data-asana-gid='<%= assignee_id %>' />, please proceed with the release <a data-asana-gid='<%= task_id %>'
data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<body>
<h2>[ACTION NEEDED] Public release <%= args['tag'] %> tagged</h2>
<h2>[ACTION NEEDED] Public release <%= tag %> tagged</h2>
<ul>
<li>🏷️ Repository is tagged with <code><%= args['tag'] %></code> tag.</li>
<li>🚢 GitHub <a href='<%= args['release_url'] %>'><%= args['tag'] %> release</a> is created.</li>
<li><b>❗️ Deleting <code><%= args['branch'] %></code> failed.</b>
<li>🏷️ Repository is tagged with <code><%= tag %></code> tag.</li>
<li>🚢 GitHub <a href='<%= release_url %>'><%= tag %> release</a> is created.</li>
<li><b>❗️ Deleting <code><%= branch %></code> failed.</b>
<ul>
<li><a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with deleting the branch manually <a
data-asana-gid='<%= args['task_id'] %>' data-asana-dynamic='false'>according to instructions</a>.</li>
<li><a data-asana-gid='<%= assignee_id %>' />, please proceed with deleting the branch manually <a
data-asana-gid='<%= task_id %>' data-asana-dynamic='false'>according to instructions</a>.</li>
</ul>
</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<body>
<h2>Public release <%= args['tag'] %> has been tagged ✅</h2>
<h2>Public release <%= tag %> has been tagged ✅</h2>
<ul>
<li>📥 DMG is available from <a href='<%= args['dmg_url'] %>'><%= args['dmg_url'] %></a>.</li>
<li>🏷️ Repository is tagged with <code><%= args['tag'] %></code> tag.</li>
<li>🚢 GitHub <a href='<%= args['release_url'] %>'><%= args['tag'] %> release</a> is created.</li>
<li>🔱 <code><%= args['branch'] %></code> branch has been deleted.</li>
<li>📥 DMG is available from <a href='<%= dmg_url %>'><%= dmg_url %></a>.</li>
<li>🏷️ Repository is tagged with <code><%= tag %></code> tag.</li>
<li>🚢 GitHub <a href='<%= release_url %>'><%= tag %> release</a> is created.</li>
<li>🔱 <code><%= branch %></code> branch has been deleted.</li>
<li>🚀 The relase will be published to Sparkle in a few minutes (you'll get notified).</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<body>
<h2>Build <%= args['tag'] %> is available for internal testing through Sparkle 🚀</h2>
<h2>Build <%= tag %> is available for internal testing through Sparkle 🚀</h2>
<ul>
<li>🌟 New appcast file has been generated and uploaded to S3, together with binary delta files.</li>
<li>👀 <a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed by following instructions in <a
data-asana-gid='<%= args['task_id'] %>' /> which concludes the internal release process.</li>
<li>👀 <a data-asana-gid='<%= assignee_id %>' />, please proceed by following instructions in <a
data-asana-gid='<%= task_id %>' /> which concludes the internal release process.</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<body>
<h2>Build <%= args['tag'] %> is available publicly through Sparkle 🚀</h2>
<h2>Build <%= tag %> is available publicly through Sparkle 🚀</h2>
<ul>
<li>🌟 New appcast file has been generated and uploaded to S3, together with binary delta files.</li>
<li>👀 <a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed by following instructions in <a
data-asana-gid='<%= args['task_id'] %>' /> and <a data-asana-gid='<%= args['announcement_task_id'] %>' /> which concludes the release
<li>👀 <a data-asana-gid='<%= assignee_id %>' />, please proceed by following instructions in <a
data-asana-gid='<%= task_id %>' /> and <a data-asana-gid='<%= announcement_task_id %>' /> which concludes the release
process.</li>
</ul>
<br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: Generate appcast2.xml for <%= args['tag'] %> hotfix release and upload assets to S3
name: Generate appcast2.xml for <%= tag %> hotfix release and upload assets to S3
html_notes: |
<body>
Publishing <%= args['tag'] %> hotfix release failed in CI. Please follow the steps to generate the appcast file and upload files to S3 from your local machine.<br>
Publishing <%= tag %> hotfix release failed in CI. Please follow the steps to generate the appcast file and upload files to S3 from your local machine.<br>
<ol>
<li>Create a new file called <code>release-notes.txt</code> on your disk.
<ul>
<li>Add each release note as a separate line and don't add bullet points (•) – the script will add them automatically.</li>
</ul></li>
<li>Run <code>appcastManager</code>:
<ul>
<li><code>./scripts/appcast_manager/appcastManager.swift --release-hotfix-to-public-channel --dmg ~/Downloads/<%= args['dmg_name'] %> --release-notes release-notes.txt</code></li>
<li><code>./scripts/appcast_manager/appcastManager.swift --release-hotfix-to-public-channel --dmg ~/Downloads/<%= dmg_name %> --release-notes release-notes.txt</code></li>
</ul></li>
<li>Verify that the new build is in the appcast file with the latest release notes and no internal channel tag. The phased rollout tag should <em>not</em> be present:
<ul>
<li><code>&lt;sparkle:phasedRolloutInterval&gt;43200&lt;/sparkle:phasedRolloutInterval&gt;</code></li>
</ul></li>
<li>Run <code>upload_to_s3.sh</code> script:
<ul>
<li><code>./scripts/upload_to_s3/upload_to_s3.sh --run --overwrite-duckduckgo-dmg <%= args['version'] %></code></li>
<li><code>./scripts/upload_to_s3/upload_to_s3.sh --run --overwrite-duckduckgo-dmg <%= version %></code></li>
</ul></li>
</ol>
When done, please verify that "Check for Updates" works correctly:
<ol>
<li>Launch a debug version of the app with an old version number.</li>
<li>Make sure you're not identified as an internal user in the app.</li>
<li>Go to Main Menu → DuckDuckGo → Check for Updates...</li>
<li>Verify that you're being offered to update to <%= args['tag'] %>.</li>
<li>Verify that you're being offered to update to <%= tag %>.</li>
<li>Verify that the update works.</li>
</ol><br>
🔗 Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
🔗 Workflow URL: <a href='<%= workflow_url %>'><%= workflow_url %></a>.
</body>

Loading

0 comments on commit 9d1a394

Please sign in to comment.