-
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.
Merge branch 'master' into CLOUDP-241948_jira_release_version
* master: chore: Sends Slack notification when changelog update fails (#2140) chore: Adds new step in release process for updating header of changelog (#2134) update to TF 1.8.0 (#2138) doc: Updates Terraform Compatibility Matrix documentation (#2137) chore: Adds workflow that generates changelog after PR is merged (#2128)
- Loading branch information
Showing
7 changed files
with
152 additions
and
7 deletions.
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Generate Changelog | ||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: [master] | ||
paths: | ||
- .changelog/** | ||
workflow_dispatch: | ||
jobs: | ||
generate-changelog: | ||
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | ||
with: | ||
go-version-file: 'go.mod' | ||
- run: make tools update-changelog-unreleased-section | ||
- run: | | ||
if [[ $(git status --porcelain) ]]; then | ||
if ${{github.event_name == 'workflow_dispatch'}}; then | ||
MSG="Update CHANGELOG.md (Manual Trigger)" | ||
else | ||
MSG="Update CHANGELOG.md for #${{ github.event.pull_request.number }}" | ||
fi | ||
git config --local user.email [email protected] | ||
git config --local user.name changelogbot | ||
git add CHANGELOG.md | ||
git commit -m "$MSG" | ||
git push | ||
fi | ||
slack-notification: | ||
needs: [generate-changelog] | ||
if: ${{ !cancelled() && needs.generate-changelog.result == 'failure' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Send Slack message | ||
id: slack | ||
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 | ||
with: | ||
payload: | | ||
{ | ||
"text": "Automatic Changelog update failed", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*Automatic Changelog update failed* ${{ secrets.SLACK_ONCALL_TAG }}" | ||
} | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":github: Failed action" | ||
}, | ||
"url": "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
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 |
---|---|---|
|
@@ -22,31 +22,66 @@ 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 ] | ||
# QA acceptance tests are skipped when explicit input parameter is used | ||
# As this job may be skipped following jobs require using 'always()' to make sure they are still run | ||
if: needs.validate-version-input.result == 'success' && inputs.skip_tests != 'true' | ||
secrets: inherit | ||
uses: ./.github/workflows/acceptance-tests.yml | ||
with: | ||
atlas_cloud_env: "qa" | ||
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }} | ||
|
||
release: | ||
update-changelog-header: | ||
runs-on: ubuntu-latest | ||
needs: [ validate-version-input, run-qa-acceptance-tests ] | ||
if: ${{ always() && needs.validate-version-input.result == 'success' && (needs.run-qa-acceptance-tests.result == 'skipped' || needs.run-qa-acceptance-tests.result == 'success') }} | ||
# Skipped if use_existing_tag is defined, is a pre-release, or previous jobs failed. | ||
if: >- | ||
always() | ||
&& inputs.use_existing_tag != 'true' | ||
&& !contains(inputs.version_number, 'pre') | ||
&& 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: | ||
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, update-changelog-header ] | ||
# Release is skipped if there are failures in previous steps | ||
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' }} | ||
|
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
golang 1.22.2 | ||
terraform 1.7.5 | ||
terraform 1.8.0 |
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
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,30 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
: "${1?"Tag of new release must be provided"}" | ||
|
||
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_NAME"; 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)" | ||
|
||
|
||
|
||
CHANGELOG_TMP_FILE_NAME="CHANGELOG.tmp" | ||
rm -f $CHANGELOG_TMP_FILE_NAME | ||
|
||
# Insert the new version header after the "(Unreleased)" line | ||
sed "/(Unreleased)/a \\ | ||
\\ | ||
$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." |
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