Skip to content

Commit

Permalink
Add tag failed message
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Feb 6, 2024
1 parent c2c2868 commit 9f4710a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ data:
Issue the following git commands:
<ul>
<li><code>git fetch origin</code></li>
<li><code>git checkout ${BRANCH}</code></li>
<li><code>git pull origin ${BRANCH}</code></li>
<li><code>git checkout ${BASE_BRANCH}</code></li>
<li><code>git pull origin ${BASE_BRANCH}</code></li>
<li><code>git merge ${BRANCH}</code> (resolve conflicts as needed)</li>
<li><code>git push origin ${BASE_BRANCH}</code></li>
<li><code>git checkout ${BRANCH}</code> switch to the release branch</li>
<li><code>git pull origin ${BRANCH}</code> pull latest changes</li>
<li><code>git checkout ${BASE_BRANCH}</code> switch to ${BASE_BRANCH}</li>
<li><code>git pull origin ${BASE_BRANCH}</code> pull the latest code</li>
<li><code>git merge ${BRANCH}</code>
<ul>
<li>resolve conflicts as needed</li>
</ul></li>
<li><code>git push origin ${BASE_BRANCH}</code> push merged branch</li>
</ul>
Complete this task when ready and proceed with testing the build.
Expand Down
40 changes: 40 additions & 0 deletions .github/actions/asana-create-action-item/templates/tag-failed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
data:
name: Merging ${BRANCH} to ${BASE_BRANCH} failed
assignee: "${ASSIGNEE_ID}"
html_notes: |
<body>
Failed to tag the release with <code>${TAG}</code> tag.
Please follow instructions below to tag the branch, make GitHub release and merge release branch to <code>${BASE_BRANCH}</code> manually.
Issue the following git commands to tag the release and merge the branch:
<ul>
<li><code>git fetch origin</code></li>
<li><code>git checkout ${BRANCH}</code> switch to the release branch</li>
<li><code>git pull origin ${BRANCH}</code> pull latest changes</li>
<li><code>git tag ${TAG}</code> tag the release</li>
<li><code>git push origin ${TAG}</code> push the tag</li>
<li><code>git checkout ${BASE_BRANCH}</code> switch to ${BASE_BRANCH}</li>
<li><code>git pull origin ${BASE_BRANCH}</code> pull the latest code</li>
<li><code>git merge ${BRANCH}</code>
<ul>
<li>resolve conflicts as needed</li>
</ul></li>
<li><code>git push origin ${BASE_BRANCH}</code> push merged branch</li>
</ul>
To create GitHub release:
<ul>
<li>Set up GH CLI if you haven't yet: <a data-asana-gid='1203791243007683'/></li>
<li>Run the following command:
<ul>
<li><code>gh release create ${TAG} --generate-notes --prerelease --notes-start-tag ${LAST_RELEASE_TAG}</code></li>
</ul></li>
</ul>
Complete this task when ready and proceed with testing the build.
🔗 Workflow URL: <a href='${WORKFLOW_URL}'>${WORKFLOW_URL}</a>.
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
data:
html_text: |
<body>
<h2>[ACTION NEEDED] Internal release build ${TAG} ready</h2>
<ul>
<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>${BRANCH}</code> to <code>${BASE_BRANCH}</code> was skipped.</b></li>
</ul>
<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>.
🔗 Workflow URL: <a href='${WORKFLOW_URL}'>${WORKFLOW_URL}</a>.
</body>
3 changes: 0 additions & 3 deletions .github/actions/create-tag-and-github-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ outputs:
tag-created:
description: "Whether the tag has been created"
value: ${{ steps.tag-repo.conclusion == 'success' }}
release-created:
description: "Whether the release has been created"
value: ${{ steps.create-github-release.conclusion == 'success' }}
runs:
using: "composite"
steps:
Expand Down
30 changes: 24 additions & 6 deletions .github/workflows/tag_and_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,49 @@ jobs:
- name: Set common environment variables
if: always()
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "TAG=${{ steps.create-tag.outputs.tag }}" >> $GITHUB_ENV
echo "WORKFLOW_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
echo "DMG_URL=${{ vars.TEST_DMG_URL_ROOT }}duckduckgo-${{ steps.create-tag.outputs.tag }}.dmg" >> $GITHUB_ENV
echo "RELEASE_URL=https://github.com/${{ github.repository }}/releases/tag/${{ steps.create-tag.outputs.tag }}" >> $GITHUB_ENV
if [[ ${{ steps.create-tag.outputs.tag-created }} == "false" ]]; then
last_release_tag=$(gh api /repos/${{ github.repository }}/releases/latest --jq '.tag_name')
echo "LAST_RELEASE_TAG=${last_release_tag}" >> $GITHUB_ENV
fi
- name: Set up Asana templates
if: failure()
id: asana-templates
run: |
if [[ ${{ steps.create-tag.outputs.tag-created }} == "true" ]]; then
echo "task-template=merge-failed" >> $GITHUB_OUTPUT
echo "comment-template=internal-release-ready-merge-failed" >> $GITHUB_OUTPUT
else
echo "task-template=tag-failed" >> $GITHUB_OUTPUT
echo "comment-template=internal-release-ready-tag-failed" >> $GITHUB_OUTPUT
fi
- name: Create Asana task on failed merge
id: create-task-on-failed-merge
- name: Create Asana task on failure
id: create-task-on-failure
if: failure()
uses: ./.github/actions/asana-create-action-item
with:
access-token: ${{ secrets.ASANA_ACCESS_TOKEN }}
release-task-url: ${{ env.asana-task-url }}
template-name: merge-failed
template-name: ${{ steps.asana-templates.outputs.task-template }}

- name: Report failure
if: failure()
uses: ./.github/actions/asana-log-message
env:
ASSIGNEE_ID: ${{ steps.create-task-on-failed-merge.outputs.assignee-id }}
TASK_ID: ${{ steps.create-task-on-failed-merge.outputs.new-task-id }}
ASSIGNEE_ID: ${{ steps.create-task-on-failure.outputs.assignee-id }}
TASK_ID: ${{ steps.create-task-on-failure.outputs.new-task-id }}
with:
access-token: ${{ secrets.ASANA_ACCESS_TOKEN }}
task-url: ${{ env.asana-task-url }}
template-name: internal-release-ready-merge-failed
template-name: ${{ steps.asana-templates.outputs.comment-template }}

- name: Report success
if: success()
Expand Down

0 comments on commit 9f4710a

Please sign in to comment.