ci: create upcoming changelog via git-sv (#794)
https://github.com/thegeeklab/git-sv - Creates a changelog from conventional commits - Updates the changelog in an static issue (creates the issue if missing) - Only runs after a new commit was merged into `main` - Automatically determines the next version based on conv commits logic - Follows up on #788 --- The logic can also be used to create the release notes on `tag` events and the subsequent Gitea release. Didn't wanted to add all at once, though. Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/794 Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com> Co-authored-by: pat-s <patrick.schratz@gmail.com> Co-committed-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
28
.gitea/workflows/changelog.yml
Normal file
28
.gitea/workflows/changelog.yml
Normal file
@ -0,0 +1,28 @@
|
||||
name: changelog
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
container: docker.io/thegeeklab/git-sv:1.0.11
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Generate upcoming changelog
|
||||
run: |
|
||||
apk add -q --no-cache curl jq sed
|
||||
git sv rn -o changelog.md
|
||||
export RELEASE_NOTES=$(cat changelog.md)
|
||||
export ISSUE_NUMBER=$(curl -s "${{ gitea.event.repository.html_url }}/api/v1/repos/${{ gitea.repository }}/issues?state=open&q=Changelog%20for%20upcoming%20version" | jq '.[].number')
|
||||
|
||||
echo $RELEASE_NOTES
|
||||
JSON_DATA=$(echo "" | jq -Rs --arg title 'Changelog for upcoming version' --arg body "$(cat changelog.md)" '{title: $title, body: $body}')
|
||||
|
||||
if [ -z "$ISSUE_NUMBER" ]; then
|
||||
curl -s -X POST "${{ gitea.event.repository.html_url }}/api/v1/repos/${{ gitea.repository }}/issues?token=${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA"
|
||||
else
|
||||
curl -s -X PATCH "${{ gitea.event.repository.html_url }}/api/v1/repos/${{ gitea.repository }}/issues/$ISSUE_NUMBER?token=${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA"
|
||||
fi
|
57
.gitsv/config.yaml
Normal file
57
.gitsv/config.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
version: '1.1' # Configuration version.
|
||||
|
||||
versioning:
|
||||
update-major: [breaking] # Commit types used to bump major.
|
||||
update-minor: [feat, perf] # Commit types used to bump minor.
|
||||
update-patch: [build, ci, chore, fix, perf, refactor, test] # Commit types used to bump patch.
|
||||
# When type is not present on update rules and is unknown (not mapped on commit message types);
|
||||
# if ignore-unknown=false bump patch, if ignore-unknown=true do not bump version.
|
||||
ignore-unknown: false
|
||||
|
||||
tag:
|
||||
pattern: 'v%d.%d.%d' # Pattern used to create git tag.
|
||||
filter: '' # Enables you to filter for considerable tags using git pattern syntax.
|
||||
|
||||
release-notes:
|
||||
sections: # Array with each section of release note. Check template section for more information.
|
||||
- name: Breaking Changes
|
||||
section-type: breaking-changes
|
||||
- name: Features # Name used on section.
|
||||
section-type: commits # Type of the section, supported types: commits, breaking-changes.
|
||||
commit-types: [feat, perf] # Commit types for commit section-type, one commit type cannot be in more than one section.
|
||||
- name: Bug Fixes
|
||||
section-type: commits
|
||||
commit-types: [fix]
|
||||
- name: Maintenance
|
||||
section-type: commits
|
||||
commit-types: [chore, refactor]
|
||||
- name: Documentation
|
||||
commit-types: [docs]
|
||||
section-type: commits
|
||||
- name: CI
|
||||
commit-types: [ci]
|
||||
section-type: commits
|
||||
|
||||
branches: # Git branches config.
|
||||
prefix: ([a-z]+\/)? # Prefix used on branch name, it should be a regex group.
|
||||
suffix: (-.*)? # Suffix used on branch name, it should be a regex group.
|
||||
disable-issue: false # Set true if there is no need to recover issue id from branch name.
|
||||
skip: [] # List of branch names ignored on commit message validation.
|
||||
skip-detached: false # Set true if a detached branch should be ignored on commit message validation.
|
||||
|
||||
commit-message:
|
||||
# Supported commit types.
|
||||
types: [build, ci, chore, docs, feat, fix, perf, refactor, revert, style, test]
|
||||
header-selector: '' # You can put in a regex here to select only a certain part of the commit message. Please define a regex group 'header'.
|
||||
scope:
|
||||
# Define supported scopes, if blank, scope will not be validated, if not, only scope listed will be valid.
|
||||
# Don't forget to add "" on your list if you need to define scopes and keep it optional.
|
||||
values: []
|
||||
footer:
|
||||
issue: # Use "issue: {}" if you wish to disable issue footer.
|
||||
key: jira # Name used to define an issue on footer metadata.
|
||||
key-synonyms: [Jira, JIRA] # Supported variations for footer metadata.
|
||||
use-hash: false # If false, use :<space> separator. If true, use <space># separator.
|
||||
add-value-prefix: '' # Add a prefix to issue value.
|
||||
issue:
|
||||
regex: '[A-Z]+-[0-9]+' # Regex for issue id.
|
@ -37,3 +37,5 @@ unittests/
|
||||
.yamllint
|
||||
CODEOWNERS
|
||||
renovate.json5
|
||||
.commitlintrc.json
|
||||
.gitsv/
|
||||
|
Reference in New Issue
Block a user