Skip to content

Commit

Permalink
fixes after doing testing in forked repository
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBettati committed Apr 10, 2024
1 parent 0703d2b commit 38d9368
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
run: |
echo "${{ inputs.version_number }}" | grep -P '^v\d+\.\d+\.\d+(-pre[A-Za-z0-9-]*)?$'
# QA acceptance tests are skipped when explicit input parameter is used
run-qa-acceptance-tests:
needs: [ validate-version-input ]
# Skipped when explicit input parameter is used
if: needs.validate-version-input.result == 'success' && inputs.skip_tests != 'true'
secrets: inherit
uses: ./.github/workflows/acceptance-tests.yml
Expand All @@ -33,8 +33,10 @@ jobs:
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }}

update-changelog-header:
needs: [ run-qa-acceptance-tests ]
runs-on: ubuntu-latest
needs: [ validate-version-input, run-qa-acceptance-tests ]
# Skipped if use_existing_tag is defined to true or previous jobs failed.
if: ${{ always() && inputs.use_existing_tag != 'true' && needs.validate-version-input.result == 'success' && (needs.run-qa-acceptance-tests.result == 'skipped' || needs.run-qa-acceptance-tests.result == 'success') }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
Expand All @@ -53,18 +55,23 @@ jobs:
release:
runs-on: ubuntu-latest
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') }}
# previous jobs must either be successful or skipped
if: ${{ always() && needs.validate-version-input.result == 'success' && (needs.run-qa-acceptance-tests.result == 'skipped' || needs.run-qa-acceptance-tests.result == 'success') && (needs.update-changelog-header.result == 'skipped' || needs.update-changelog-header.result == 'success') }}
steps:
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }}
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || 'master' }}
- name: Unshallow
run: git fetch --prune --unshallow
- name: Get the latest commit SHA
id: get-sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Create release tag
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72
with:
tag: ${{ inputs.version_number }}
commit_sha: ${{ steps.get-sha.outputs.sha }}
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.PASSPHRASE }}
tag_exists_error: ${{ inputs.use_existing_tag != 'true' }}
Expand Down
13 changes: 9 additions & 4 deletions scripts/update-changelog-header-for-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ set -euo pipefail

: "${1?"Tag of new release must be provided"}"

CHANGELOG_FILE_PATH=CHANGELOG.md
CHANGELOG_FILE_NAME=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
if grep -q "## $RELEASE_NUMBER (" "$CHANGELOG_FILE_NAME"; then
echo "CHANGELOG already has a header defined for $RELEASE_NUMBER, no changes made to changelog."
exit 0
fi
Expand All @@ -17,9 +17,14 @@ fi
TODAYS_DATE=$(date "+%B %d, %Y") # Format the date as "Month day, Year"
NEW_RELEASE_HEADER="## $RELEASE_NUMBER ($TODAYS_DATE)"



CHANGELOG_TMP_FILE_NAME="CHANGELOG.tmp"
rm -f $CHANGELOG_TMP_FILE_NAME

# Insert the new version header after the "(Unreleased)" line
sed -i "" -e "/(Unreleased)/a \\
sed "/(Unreleased)/a \\
\\
$NEW_RELEASE_HEADER" $CHANGELOG_FILE_PATH
$NEW_RELEASE_HEADER" $CHANGELOG_FILE_NAME > $CHANGELOG_TMP_FILE_NAME && mv $CHANGELOG_TMP_FILE_NAME $CHANGELOG_FILE_NAME

echo "Changelog updated successfully defining header for new $RELEASE_TAG release."

0 comments on commit 38d9368

Please sign in to comment.