-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Adds new step in release process for updating header of changelog #2134
Conversation
b7dcad7
to
0703d2b
Compare
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' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to define master to make sure latest commit is used, more details here actions/checkout#439 (comment)
- name: Create release tag | ||
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 | ||
with: | ||
tag: ${{ inputs.version_number }} | ||
commit_sha: ${{ steps.get-sha.outputs.sha }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed so tag is added into latest commit, if not the sha used for triggering the workflow is used: actions/checkout#439 (comment)
@@ -0,0 +1,30 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if the Unreleased section was already modified before, e.g. this already ran and we're running release workflow again?
will it fail or will do nothing silently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script will output a message like CHANGELOG already has a header defined for 1.16.0, no changes made to changelog.
(example: https://github.com/AgustinBettati/terraform-provider-mongodbatlas/actions/runs/8638524825/job/23683156506).
@@ -22,31 +22,66 @@ jobs: | |||
run: | | |||
echo "${{ inputs.version_number }}" | grep -P '^v\d+\.\d+\.\d+(-pre[A-Za-z0-9-]*)?$' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once the release is finished successfully, do we need to put the Unrelease header again in the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from what I see here, Unreleased header is never removed and the new versions are always put after the unreleased header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the Unreleased header is preserved at the top of the changelog, example commit.
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: >- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
knitpit: this condition is a bit complex
git config --local user.name changelogbot | ||
git add CHANGELOG.md | ||
git commit -m "$MSG" | ||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related to previous comment, if there is no change to the file because was already updated, is an empty commit pushed or no action is done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if no change to the file is done $(git status --porcelain)
will be false and no action is done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see. a small issue that could happen is that we start release one afternoon, there are some problems, we finish the release next day, but the changelog release section date is yesterday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, not sure if the concern is worth making the solution more complex (check if header of current release is present and updating the date). If it ever becomes a significant gap a commit can adjust the date before or after the release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree not to address it now
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you are using or
but if condition is all and
. Which one is correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the comment mentions when the job is skipped, while the if statement defines when it is run.
* 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)
* master: fix: Removes default comment when creating resource `mongodbatlas_privatelink_endpoint_serverless` and adds update support to `mongodbatlas_privatelink_endpoint_service_serverless` (#2133) doc: Documents testing best practices (#2132) chore: Uses correct format when setting remote (#2147) chore: Configures git correctly for automatic commit (#2146) chore: Uses PAT of bot to commit changelog updates (#2144) doc: Adjust RELEASING.md documentation with new process (#2142) fix: Fixes nil pointer dereference if `advanced_configuration` update fails in `mongodbatlas_cluster` (#2139) chore: Adds a new step in release process that marks Jira version as released (#2136) chore: Sends Slack notification when changelog update fails (#2140) chore: Adds new step in release process for updating header of changelog (#2134)
Description
Link to any related issue(s): CLOUDP-241731
Defines a new job that automatically adjusts the CHANGELOG.md header section during a new release.
This PR contemplates the possibility of doing pre-releases (by skipping this job), this will not be needed for our regular release process but could be useful in the future if we want to share a preview to customers (pointed out by Melissa in the scope).
Testing
Type of change:
Required Checklist:
Further comments