forked from CiscoDevNet/terraform-provider-aci
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ignore] Add Pre-Release PR workflow (CiscoDevNet#1253)
- Loading branch information
Showing
2 changed files
with
120 additions
and
0 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,56 @@ | ||
name: release_pr | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
# git-cliff to generate CHANGELOG.md | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- run: pip install git-cliff typos | ||
- name: Get next version | ||
id: vars | ||
run: echo "version=$(git cliff --bumped-version)" >> $GITHUB_OUTPUT | ||
- name: Generate changelog output | ||
run: git cliff --bump --unreleased | ||
- name: Prepend new changelog entry | ||
run: git cliff --bump --unreleased -p CHANGELOG.md | ||
|
||
# Generate annotation_unsupported.go | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Generate annotation unsupported provider code | ||
run: go generate | ||
env: | ||
GEN_ANNOTATION_UNSUPPORTED: '1' | ||
|
||
# Commit changes to release_pr branch | ||
- name: Set git config | ||
run: git config user.email "[email protected]" && git config user.name "dcn-ecosystem" | ||
- name: Commit | ||
run: git add -u && git status && git commit -m "[ignore] Update Changelog and annotation_unsupported.go for new release (${{ steps.vars.outputs.version }})" | ||
- name: Branch & Push | ||
run: git checkout -b release_pr && git push --set-upstream origin release_pr --force && git clean -f -d | ||
|
||
# Create or update release PR | ||
- run: gh pr create --base master --head release_pr --title "Pre-Release PR (${{ steps.vars.outputs.version }})" --body "" | ||
id: pr | ||
continue-on-error: true | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- run: gh pr edit release_pr --title "Pre-Release PR (${{ steps.vars.outputs.version }})" | ||
if: steps.pr.outcome == 'failure' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,64 @@ | ||
# git-cliff ~ configuration file | ||
# https://git-cliff.org/docs/configuration | ||
|
||
[changelog] | ||
header = """ | ||
# Terraform Provider ACI - Changelog\n | ||
All notable changes to this project will be documented in this file.\n | ||
""" | ||
# template for the changelog body | ||
# https://keats.github.io/tera/docs/#introduction | ||
# TODO find a nicer way to remove the [something] tags from the start of commits. | ||
body = """ | ||
{% if version %}\ | ||
## {{ version | trim_start_matches(pat="v") }} ({{ timestamp | date(format="%B %d, %Y") }}) | ||
{% else %}\ | ||
## [unreleased] | ||
{% endif %}\ | ||
{% for group, commits in commits | group_by(attribute="group") %} | ||
{{ group | striptags | trim | upper_first }}: | ||
{% for commit in commits -%} | ||
- {{ commit.message | trim | ||
| trim_start_matches(pat="[bugfix]") | ||
| trim_start_matches(pat="[bug_fix]") | ||
| trim_start_matches(pat="[bugfixes]") | ||
| trim_start_matches(pat="[minor_change]") | ||
| trim_start_matches(pat="[minor_changes]") | ||
| trim_start_matches(pat="[major_change]") | ||
| trim_start_matches(pat="[major_changes]") | ||
| trim | capitalize }} | ||
{% endfor -%} | ||
{% endfor %}\n | ||
""" | ||
footer = """ | ||
""" | ||
trim = true | ||
postprocessors = [ | ||
{ pattern = '.*', replace_command = 'typos --write-changes -' } | ||
] | ||
|
||
[git] | ||
conventional_commits = false | ||
filter_unconventional = false | ||
split_commits = false | ||
commit_preprocessors = [] | ||
commit_parsers = [ | ||
{ message = "^.[I|i]gnore", skip = true }, | ||
{ message = "^Bump", skip = true }, # Ignore Dependabot version bumps | ||
{ message = "^Merge.branch", skip = true }, # Ignore merge commits | ||
{ message = "^.[M|m]ajor", group = "<!-- 0 -->BREAKING CHANGES" }, | ||
{ message = "[D|d]eprecat", group = "<!-- 1 -->DEPRECATIONS" }, | ||
{ message = "^.[M|m]inor", group = "<!-- 2 -->IMPROVEMENTS" }, | ||
{ message = "^.[B|b]ug", group = "<!-- 3 -->BUG FIXES" }, | ||
{ message = ".*", group = "<!-- 4 -->OTHER" }, | ||
] | ||
protect_breaking_commits = false | ||
filter_commits = true | ||
topo_order = false | ||
sort_commits = "oldest" | ||
|
||
[bump] | ||
features_always_bump_minor = true | ||
breaking_always_bump_major = true | ||
custom_major_increment_regex = "major" | ||
custom_minor_increment_regex = "minor" |