-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: define new job in release process for updating header of chang…
…elog
- Loading branch information
1 parent
5a7d85c
commit 0703d2b
Showing
2 changed files
with
44 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,27 @@ jobs: | |
atlas_cloud_env: "qa" | ||
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }} | ||
|
||
update-changelog-header: | ||
needs: [ run-qa-acceptance-tests ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | ||
with: | ||
fetch-depth: 0 | ||
- run: ./scripts/update-changelog-header-for-release.sh ${{inputs.version_number}} | ||
- run: | | ||
if [[ $(git status --porcelain) ]]; then | ||
MSG="Update CHANGELOG.md header for ${{inputs.version_number}} release" | ||
git config --local user.email [email protected] | ||
git config --local user.name changelogbot | ||
git add CHANGELOG.md | ||
git commit -m "$MSG" | ||
git push | ||
fi | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [ validate-version-input, run-qa-acceptance-tests ] | ||
needs: [ validate-version-input, run-qa-acceptance-tests, update-changelog-header ] | ||
if: ${{ always() && needs.validate-version-input.result == 'success' && (needs.run-qa-acceptance-tests.result == 'skipped' || needs.run-qa-acceptance-tests.result == 'success') }} | ||
steps: | ||
- name: Checkout | ||
|
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
: "${1?"Tag of new release must be provided"}" | ||
|
||
CHANGELOG_FILE_PATH=CHANGELOG.md | ||
RELEASE_TAG=$1 | ||
RELEASE_NUMBER=$(echo "${RELEASE_TAG}" | tr -d v) | ||
|
||
# exit out if changelog already has the header updated with version number being released. | ||
if grep -q "## $RELEASE_NUMBER (" "$CHANGELOG_FILE_PATH"; then | ||
echo "CHANGELOG already has a header defined for $RELEASE_NUMBER, no changes made to changelog." | ||
exit 0 | ||
fi | ||
|
||
# Prepare the new version header | ||
TODAYS_DATE=$(date "+%B %d, %Y") # Format the date as "Month day, Year" | ||
NEW_RELEASE_HEADER="## $RELEASE_NUMBER ($TODAYS_DATE)" | ||
|
||
# Insert the new version header after the "(Unreleased)" line | ||
sed -i "" -e "/(Unreleased)/a \\ | ||
\\ | ||
$NEW_RELEASE_HEADER" $CHANGELOG_FILE_PATH | ||
|
||
echo "Changelog updated successfully defining header for new $RELEASE_TAG release." |