Skip to content

Commit

Permalink
Validate that release notes are present before publishing a new relea…
Browse files Browse the repository at this point in the history
…se (#2321)

Task/Issue URL: https://app.asana.com/0/1177771139624306/1206760506719785/f

Description:
As first step in Bump Internal Release and Publish DMG Release workflows, validate
that release notes in the Asana task are not empty or not a placeholder.
  • Loading branch information
ayoy authored Mar 5, 2024
1 parent e71a0a0 commit 5088c45
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ data:
</ul></li>
</ul>
Complete this task when ready and proceed with testing the build.
Complete this task when ready and proceed with testing the build. If you're bumping an internal release, you should get another task asking you to publish the release in Sparkle.
Look for other tasks in <a data-asana-gid='${AUTOMATION_TASK_ID}'/> task and handle them as needed.
🔗 Workflow URL: <a href='${WORKFLOW_URL}'>${WORKFLOW_URL}</a>.
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/bump_internal_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ jobs:
*) echo "👎 Not a release branch"; exit 1 ;;
esac
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}

- name: Extract Asana Task ID
id: task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ github.event.inputs.asana-task-url }}

- name: Validate release notes
env:
TASK_ID: ${{ steps.task-id.outputs.task-id }}
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
run: |
curl -fLSs "https://app.asana.com/api/1.0/tasks/${TASK_ID}?opt_fields=notes" \
-H "Authorization: Bearer ${ASANA_ACCESS_TOKEN}" \
| jq -r .data.notes \
| ./scripts/extract_release_notes.sh > release_notes.txt
release_notes="$(<release_notes.txt)"
if [[ ${#release_notes} == 0 || "$release_notes" == "<-- Add release notes here -->" ]]; then
echo "::error::Release notes are empty. Please add release notes to the Asana task and restart the workflow."
exit 1
fi
run_tests:

name: Run Tests
Expand Down
41 changes: 23 additions & 18 deletions .github/workflows/publish_dmg_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

name: Tag public release

# Run if release-type is provided (not empty) an is not internal
# Run if release-type is provided (not empty) and is not internal
if: contains(github.event.inputs.release-type, '') == false && github.event.inputs.release-type != 'internal'

uses: ./.github/workflows/tag_release.yml
Expand Down Expand Up @@ -111,6 +111,28 @@ jobs:
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer

- name: Extract Asana Task ID
id: task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ github.event.inputs.asana-task-url }}

- name: Fetch and validate release notes
env:
TASK_ID: ${{ steps.task-id.outputs.task-id }}
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
run: |
curl -fLSs "https://app.asana.com/api/1.0/tasks/${TASK_ID}?opt_fields=notes" \
-H "Authorization: Bearer ${ASANA_ACCESS_TOKEN}" \
| jq -r .data.notes \
| ./scripts/extract_release_notes.sh > release_notes.txt
release_notes="$(<release_notes.txt)"
if [[ ${#release_notes} == 0 || "$release_notes" == "<-- Add release notes here -->" ]]; then
echo "::error::Release notes are empty. Please add release notes to the Asana task and restart the workflow."
exit 1
fi
echo "RELEASE_NOTES_FILE=release_notes.txt" >> $GITHUB_ENV
- name: Set up Sparkle tools
env:
SPARKLE_URL: https://github.com/sparkle-project/Sparkle/releases/download/${{ vars.SPARKLE_VERSION }}/Sparkle-${{ vars.SPARKLE_VERSION }}.tar.xz
Expand All @@ -131,23 +153,6 @@ jobs:
echo "dmg-name=$DMG_NAME" >> $GITHUB_OUTPUT
echo "dmg-path=$DMG_NAME" >> $GITHUB_OUTPUT
- name: Extract Asana Task ID
id: task-id
uses: ./.github/actions/asana-extract-task-id
with:
task-url: ${{ github.event.inputs.asana-task-url }}

- name: Fetch release notes
env:
TASK_ID: ${{ steps.task-id.outputs.task-id }}
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
run: |
curl -fLSs "https://app.asana.com/api/1.0/tasks/${TASK_ID}?opt_fields=notes" \
-H "Authorization: Bearer ${ASANA_ACCESS_TOKEN}" \
| jq -r .data.notes \
| ./scripts/extract_release_notes.sh > release_notes.txt
echo "RELEASE_NOTES_FILE=release_notes.txt" >> $GITHUB_ENV
- name: Generate appcast
id: appcast
env:
Expand Down

0 comments on commit 5088c45

Please sign in to comment.