Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e8c640f35 | |||
|
8aa3c1c8d2
|
|||
| d3223c0956 | |||
|
0a562d4e02
|
|||
| c671a6524f | |||
|
ad7c5a4f85
|
|||
|
18b493d524
|
|||
| 466c1c4918 | |||
|
3d50c5cc8d
|
|||
|
a753d6aa3b
|
|||
| 7bba14fe49 | |||
|
c8628e7bd7
|
|||
|
df27af76ad
|
|||
| 6b4016177f | |||
|
33c5c71923
|
|||
|
8df31fb97e
|
|||
| 5abdff1d1c | |||
|
ec44bde050
|
|||
|
30f83b08ee
|
|||
| 5771982931 | |||
|
2df09c467e
|
|||
|
09e41744fb
|
|||
| e12595d0a8 | |||
|
4254a7f534
|
|||
|
543b311d1e
|
73
CHANGELOG.md
73
CHANGELOG.md
@@ -2,63 +2,48 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## [1.2.2](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v1.2.1..v1.2.2) - 2025-11-24
|
## [2.0.7](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.6..v2.0.7) - 2025-07-04
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- *(scripts)* Improve version argument handling in install script - ([e050996](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/e050996fd4d153f59cce0c9483851cae4963908d))
|
- *(path)* Correct script directory resolution - ([0a562d4](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/0a562d4e029193c4e39926d1ff220a6a37a6e049))
|
||||||
|
|
||||||
## [1.2.1](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v1.2.0..v1.2.1) - 2025-11-24
|
## [2.0.6](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.5..v2.0.6) - 2025-07-04
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- *(scripts)* Simplify path management and command execution - ([18b493d](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/18b493d524630e8da304e2a8ec098415fa9140e1))
|
||||||
|
|
||||||
|
## [2.0.5](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.4..v2.0.5) - 2025-07-04
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- *(scripts)* Remove redundant output on missing config file - ([ce5cb7b](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/ce5cb7bcc0435931a24b017c2fdacf03eb084032))
|
- *(script)* Correct path formatting in version detection script - ([a753d6a](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/a753d6aa3b45d4dab36e4ef56bbc71046eb032c9))
|
||||||
|
|
||||||
## [1.2.0](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v1.1.0..v1.2.0) - 2025-11-24
|
## [2.0.4](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.3..v2.0.4) - 2025-07-04
|
||||||
|
|
||||||
### 🚀 Features
|
|
||||||
|
|
||||||
- Add templated git-cliff config generation to workflow - ([096ecb5](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/096ecb582296cdd479a32d5eb58512af76621102))
|
|
||||||
- *(changelog)* Add support for indented commit bodies - ([a83ee3e](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/a83ee3e88f87c3d99368ee1e62f45f4f30dd46c1))
|
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
|
||||||
|
|
||||||
- *(config)* Adjust formatting and improve changelog parsing - ([d8bf074](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/d8bf0743f7ece328d76a3cde52aac75b1691ada6))
|
|
||||||
|
|
||||||
## [1.1.0](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v1.0.1..v1.1.0) - 2025-09-29
|
|
||||||
|
|
||||||
### 🚀 Features
|
|
||||||
|
|
||||||
- *(scripts)* Add type extraction and mismatch detection logic - ([e8426bb](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/e8426bb839dd29f807f232efe5f7bf829ec4f9f1))
|
|
||||||
|
|
||||||
### 📚 Documentation
|
|
||||||
|
|
||||||
- Add changelog improvement ideas to TODO file - ([f54df9f](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/f54df9fbc42e3fc453042a1f2c36f7cd12e38c41))
|
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
|
||||||
|
|
||||||
- *(config)* Improve child commit handling in merge template - ([65462f5](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/65462f5a1495aa45afd727a962126db953ab75a5))
|
|
||||||
|
|
||||||
## [1.0.1](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v1.0.0..v1.0.1) - 2025-09-27
|
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
|
||||||
|
|
||||||
- *(scripts)* Check for existing Python installation - ([94980be](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/94980be3e5e5827b75edf9abeab0987709fa3122))
|
|
||||||
|
|
||||||
## [1.0.0](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.3..v1.0.0) - 2025-09-27
|
|
||||||
|
|
||||||
### 🚀 Features
|
|
||||||
|
|
||||||
- *(ci)* [**breaking**] Enhance changelog generation with context augmentation - ([8de8b47](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/8de8b470386cf9f21cec660ba71d840ea6786231))
|
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- *(release)* Fix changelog generation pipe usage - ([fedcc1f](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/fedcc1ff41b9535f5002d046427dd640b647bde4))
|
- *(main)* Update script path to ensure correct resolution - ([df27af7](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/df27af76add1dc4b50ead8015976b5e96b177661))
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
## [2.0.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.2..v2.0.3) - 2025-07-04
|
||||||
|
|
||||||
- *(release)* Update action version in workflow - ([73a1b5c](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/73a1b5cc243248b50275b2368a4cd92bbb4a1a8e))
|
### 🚜 Refactor
|
||||||
- *(ci)* Allow non-main branch releases - ([121ea5b](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/121ea5b57a587626a036738c23e2983380470dd7))
|
|
||||||
|
- *(action)* Simplify composite action structure - ([8df31fb](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/8df31fb97ebd73e71b2f8a9dc925fe8a81192be3))
|
||||||
|
|
||||||
|
## [2.0.2](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v2.0.1..v2.0.2) - 2025-07-04
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- *(actions)* Simplify action path structure - ([30f83b0](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/30f83b08eecabe17b7d1f53aaf0bb4d0cdd82256))
|
||||||
|
|
||||||
|
## [2.0.1](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.3..v2.0.1) - 2025-07-04
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(workflows)* Allow non-main branch releases - ([09e4174](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/09e41744fbf920c0253e13644cb38f1dd430c0f3))
|
||||||
|
- *(actions)* Add post-step support for composite actions - ([543b311](https://git.0xmax42.io/actions/auto-changelog-release-action/commit/543b311d1eb1fb83e8e0ef4014c549e61a863038))
|
||||||
|
|
||||||
## [0.4.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.2..v0.4.3) - 2025-06-29
|
## [0.4.3](https://git.0xmax42.io/actions/auto-changelog-release-action/compare/v0.4.2..v0.4.3) - 2025-06-29
|
||||||
|
|
||||||
|
|||||||
46
TODO.md
46
TODO.md
@@ -1,46 +0,0 @@
|
|||||||
# TODO
|
|
||||||
|
|
||||||
## Git-Cliff / Changelog Improvements
|
|
||||||
|
|
||||||
### Idea: Use Merge Commit Body as Documentation
|
|
||||||
|
|
||||||
* **Context**: Normally, only the commit subject is included in changelogs.
|
|
||||||
* **Idea**: Treat merge commits as *project documentation*.
|
|
||||||
|
|
||||||
* The subject line = headline of the feature / branch.
|
|
||||||
* The body = narrative explanation of what the branch accomplished.
|
|
||||||
* Child commits = detailed steps, already included under the merge.
|
|
||||||
|
|
||||||
### Benefits
|
|
||||||
|
|
||||||
* Provides more context for each feature branch.
|
|
||||||
* Turns the changelog into a lightweight project documentation.
|
|
||||||
* Keeps individual commits small and clean while still showing the bigger picture.
|
|
||||||
* Optional: if no body is present, nothing changes.
|
|
||||||
|
|
||||||
### Possible Implementation
|
|
||||||
|
|
||||||
* In the changelog template:
|
|
||||||
|
|
||||||
* Detect merge commits.
|
|
||||||
* Render `commit.body` below the subject line.
|
|
||||||
* Indent and format properly (e.g. bullet points preserved).
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
```
|
|
||||||
### 🚀 Features
|
|
||||||
|
|
||||||
- 🔀 **Merge branch 'feature/oauth2'** - ([abc1234](...))
|
|
||||||
Add OAuth2 login flow with full explanation of scope:
|
|
||||||
- why OAuth2 was chosen
|
|
||||||
- compatibility with existing login
|
|
||||||
- possible future extensions
|
|
||||||
|
|
||||||
- *(auth)* Add login endpoint - ([def5678](...))
|
|
||||||
- *(auth)* Implement token exchange - ([ghi9012](...))
|
|
||||||
- *(auth)* Add error handling - ([jkl3456](...))
|
|
||||||
- *(test)* Add unit tests for OAuth2 flow - ([mno7890](...))
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
63
action.yml
63
action.yml
@@ -1,5 +1,5 @@
|
|||||||
name: Auto Changelog & Release
|
name: Auto Changelog & Release
|
||||||
description: "One-stop composite action for version-bump detection, changelog generation and Gitea release."
|
description: One-stop composite action
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
token:
|
||||||
@@ -19,58 +19,11 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
release:
|
||||||
|
description: "Whether a release should be made (true/false)"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "node20"
|
||||||
steps:
|
main: "dist/main.js"
|
||||||
- name: Detect version change
|
post: "dist/post.js"
|
||||||
shell: bash
|
|
||||||
id: detect
|
|
||||||
env:
|
|
||||||
GITHUB_EVENT_BEFORE: ${{ github.event.before || '' }}
|
|
||||||
GITHUB_SHA: ${{ github.sha || '' }}
|
|
||||||
GITHUB_REF: ${{ github.ref || '' }}
|
|
||||||
ALLOW_NON_MAIN_RELEASE: ${{ inputs.allow_non_main_release }}
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/detect-version-change.sh
|
|
||||||
|
|
||||||
- name: Read CLIFF_VERSION
|
|
||||||
shell: bash
|
|
||||||
id: cliff_version
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/read-cliff-version.sh
|
|
||||||
|
|
||||||
- name: Generate git-cliff config
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/generate-git-cliff-config.sh
|
|
||||||
|
|
||||||
- name: Install git-cliff
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/install-git-cliff.sh "${{ steps.cliff_version.outputs.version }}"
|
|
||||||
|
|
||||||
- name: Install Python
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/install-python.sh
|
|
||||||
|
|
||||||
- name: Set up git
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/setup-git.sh \
|
|
||||||
"${{ inputs.author_name }}" \
|
|
||||||
"${{ inputs.author_email }}"
|
|
||||||
|
|
||||||
- name: Generate and commit changelog (unreleased)
|
|
||||||
if: steps.detect.outputs.version_changed == 'false'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/generate-unreleased-changelog.sh
|
|
||||||
|
|
||||||
- name: Release from VERSION
|
|
||||||
if: steps.detect.outputs.version_changed == 'true'
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
RELEASE_PUBLISH_TOKEN: ${{ inputs.token || '' }}
|
|
||||||
run: |
|
|
||||||
${{ github.action_path }}/scripts/release-from-version.sh
|
|
||||||
|
|||||||
89
cliff.toml
89
cliff.toml
@@ -1,4 +1,4 @@
|
|||||||
# CLIFF_VERSION=2.10.1
|
# CLIFF_VERSION=2.8.0
|
||||||
# git-cliff ~ default configuration file
|
# git-cliff ~ default configuration file
|
||||||
# https://git-cliff.org/docs/configuration
|
# https://git-cliff.org/docs/configuration
|
||||||
#
|
#
|
||||||
@@ -10,27 +10,23 @@ owner = "actions"
|
|||||||
repo = "auto-changelog-release-action"
|
repo = "auto-changelog-release-action"
|
||||||
|
|
||||||
[changelog]
|
[changelog]
|
||||||
|
# postprocessors
|
||||||
postprocessors = [
|
postprocessors = [
|
||||||
{ pattern = '<GITEA_URL>', replace = "https://git.0xmax42.io" }, # replace gitea url
|
{ pattern = '<GITEA_URL>', replace = "https://git.0xmax42.io" }, # replace gitea url
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# template for the changelog header
|
||||||
header = """
|
header = """
|
||||||
# Changelog\n
|
# Changelog\n
|
||||||
All notable changes to this project will be documented in this file.\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
|
||||||
body = """
|
body = """
|
||||||
{%- macro remote_url() -%}
|
{%- macro remote_url() -%}
|
||||||
<GITEA_URL>/{{ remote.gitea.owner }}/{{ remote.gitea.repo }}
|
<GITEA_URL>/{{ remote.gitea.owner }}/{{ remote.gitea.repo }}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro indent(text, prefix=" ") -%}
|
|
||||||
{%- set lines = text | split(pat="\n") -%}
|
|
||||||
{%- for l in lines -%}
|
|
||||||
{{ prefix ~ l }}{% if not loop.last %}{{ "\n" }}{% endif %}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endmacro -%}
|
|
||||||
|
|
||||||
{% if version %}\
|
{% if version %}\
|
||||||
{% if previous.version %}\
|
{% if previous.version %}\
|
||||||
## [{{ version | trim_start_matches(pat="v") }}]\
|
## [{{ version | trim_start_matches(pat="v") }}]\
|
||||||
@@ -42,29 +38,16 @@ body = """
|
|||||||
## [unreleased]
|
## [unreleased]
|
||||||
{% endif %}\
|
{% endif %}\
|
||||||
{% for group, commits in commits | group_by(attribute="group") %}
|
{% for group, commits in commits | group_by(attribute="group") %}
|
||||||
### {{ group | striptags | trim | upper_first }}\n
|
### {{ group | striptags | trim | upper_first }}
|
||||||
{% for commit in commits %}\
|
{% for commit in commits %}
|
||||||
{% if commit.merge_commit %}\
|
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
||||||
- 🔀 **{{ commit.message | upper_first }}** - \
|
{% if commit.breaking %}[**breaking**] {% endif %}\
|
||||||
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
{{ commit.message | upper_first }} - \
|
||||||
{% if commit.body %}\n{{ self::indent(text=commit.body, prefix=" ") }}{% endif %}\
|
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
||||||
{% if commit.extra and commit.extra.children %}\
|
{% endfor %}
|
||||||
{% for child in commit.extra.children %}
|
|
||||||
{{ " " | safe }}- {% if child.extra.mismatch_type %}**{{ child.extra.mismatch_type }}**:{% endif %}{% if child.scope %}*({{ child.scope }})* {% endif %}\
|
|
||||||
{% if child.breaking %}[**breaking**] {% endif %}\
|
|
||||||
{{ child.message | upper_first }} - \
|
|
||||||
([{{ child.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ child.id }}))\
|
|
||||||
{% endfor %}\
|
|
||||||
{% endif %}\
|
|
||||||
{% else %}\
|
|
||||||
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
|
||||||
{% if commit.breaking %}[**breaking**] {% endif %}\
|
|
||||||
{{ commit.message | upper_first }} - \
|
|
||||||
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}\
|
|
||||||
{% endfor %}\n
|
{% endfor %}\n
|
||||||
"""
|
"""
|
||||||
|
# template for the changelog footer
|
||||||
footer = """
|
footer = """
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -85,31 +68,31 @@ filter_unconventional = true
|
|||||||
split_commits = false
|
split_commits = false
|
||||||
# regex for preprocessing the commit messages
|
# regex for preprocessing the commit messages
|
||||||
commit_preprocessors = [
|
commit_preprocessors = [
|
||||||
# Replace issue numbers
|
# Replace issue numbers
|
||||||
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
|
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
|
||||||
# Check spelling of the commit with https://github.com/crate-ci/typos
|
# Check spelling of the commit with https://github.com/crate-ci/typos
|
||||||
# If the spelling is incorrect, it will be automatically fixed.
|
# If the spelling is incorrect, it will be automatically fixed.
|
||||||
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
|
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
|
||||||
]
|
]
|
||||||
# regex for parsing and grouping commits
|
# regex for parsing and grouping commits
|
||||||
commit_parsers = [
|
commit_parsers = [
|
||||||
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
|
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
|
||||||
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
|
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
|
||||||
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
|
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
|
||||||
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
|
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
|
||||||
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
||||||
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
||||||
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
||||||
{ message = "^chore\\(changelog\\)", skip = true },
|
{ message = "^chore\\(changelog\\)", skip = true },
|
||||||
{ message = "^chore\\(version\\)", skip = true },
|
{ message = "^chore\\(version\\)", skip = true },
|
||||||
{ message = "^chore\\(release\\): prepare for", skip = true },
|
{ message = "^chore\\(release\\): prepare for", skip = true },
|
||||||
{ message = "^chore\\(deps.*\\)", skip = true },
|
{ message = "^chore\\(deps.*\\)", skip = true },
|
||||||
{ message = "^chore\\(pr\\)", skip = true },
|
{ message = "^chore\\(pr\\)", skip = true },
|
||||||
{ message = "^chore\\(pull\\)", skip = true },
|
{ message = "^chore\\(pull\\)", skip = true },
|
||||||
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
|
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
|
||||||
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
||||||
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
|
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
|
||||||
{ message = ".*", group = "<!-- 10 -->💼 Other" },
|
{ message = ".*", group = "<!-- 10 -->💼 Other" },
|
||||||
]
|
]
|
||||||
# Regex to select git tags that represent releases.
|
# Regex to select git tags that represent releases.
|
||||||
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
# git-cliff ~ default configuration file
|
|
||||||
# https://git-cliff.org/docs/configuration
|
|
||||||
#
|
|
||||||
# Lines starting with "#" are comments.
|
|
||||||
# Configuration options are organized into tables and keys.
|
|
||||||
# See documentation for more information on available options.
|
|
||||||
[remote.gitea]
|
|
||||||
owner = "%OWNER%"
|
|
||||||
repo = "%REPO%"
|
|
||||||
|
|
||||||
[changelog]
|
|
||||||
postprocessors = [
|
|
||||||
{ pattern = '<GITEA_URL>', replace = "https://git.0xmax42.io" }, # replace gitea url
|
|
||||||
]
|
|
||||||
|
|
||||||
header = """
|
|
||||||
# Changelog\n
|
|
||||||
All notable changes to this project will be documented in this file.\n
|
|
||||||
"""
|
|
||||||
|
|
||||||
body = """
|
|
||||||
{%- macro remote_url() -%}
|
|
||||||
<GITEA_URL>/{{ remote.gitea.owner }}/{{ remote.gitea.repo }}
|
|
||||||
{%- endmacro -%}
|
|
||||||
|
|
||||||
{%- macro indent(text, prefix=" ") -%}
|
|
||||||
{%- set lines = text | split(pat="\n") -%}
|
|
||||||
{%- for l in lines -%}
|
|
||||||
{{ prefix ~ l }}{% if not loop.last %}{{ "\n" }}{% endif %}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endmacro -%}
|
|
||||||
|
|
||||||
{% if version %}\
|
|
||||||
{% if previous.version %}\
|
|
||||||
## [{{ version | trim_start_matches(pat="v") }}]\
|
|
||||||
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
|
|
||||||
{% else %}\
|
|
||||||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
|
||||||
{% endif %}\
|
|
||||||
{% else %}\
|
|
||||||
## [unreleased]
|
|
||||||
{% endif %}\
|
|
||||||
{% for group, commits in commits | group_by(attribute="group") %}
|
|
||||||
### {{ group | striptags | trim | upper_first }}\n
|
|
||||||
{% for commit in commits %}\
|
|
||||||
{% if commit.merge_commit %}\
|
|
||||||
- 🔀 **{{ commit.message | upper_first }}** - \
|
|
||||||
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
|
||||||
{% if commit.body %}\n{{ self::indent(text=commit.body, prefix=" ") }}{% endif %}\
|
|
||||||
{% if commit.extra and commit.extra.children %}\
|
|
||||||
{% for child in commit.extra.children %}
|
|
||||||
{{ " " | safe }}- {% if child.extra.mismatch_type %}**{{ child.extra.mismatch_type }}**:{% endif %}{% if child.scope %}*({{ child.scope }})* {% endif %}\
|
|
||||||
{% if child.breaking %}[**breaking**] {% endif %}\
|
|
||||||
{{ child.message | upper_first }} - \
|
|
||||||
([{{ child.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ child.id }}))\
|
|
||||||
{% endfor %}\
|
|
||||||
{% endif %}\
|
|
||||||
{% else %}\
|
|
||||||
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
|
||||||
{% if commit.breaking %}[**breaking**] {% endif %}\
|
|
||||||
{{ commit.message | upper_first }} - \
|
|
||||||
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}\
|
|
||||||
{% endfor %}\n
|
|
||||||
"""
|
|
||||||
footer = """
|
|
||||||
|
|
||||||
"""
|
|
||||||
# remove the leading and trailing s
|
|
||||||
trim = true
|
|
||||||
|
|
||||||
# render body even when there are no releases to process
|
|
||||||
# render_always = true
|
|
||||||
# output file path
|
|
||||||
# output = "test.md"
|
|
||||||
|
|
||||||
[git]
|
|
||||||
# parse the commits based on https://www.conventionalcommits.org
|
|
||||||
conventional_commits = true
|
|
||||||
# filter out the commits that are not conventional
|
|
||||||
filter_unconventional = true
|
|
||||||
# process each line of a commit as an individual commit
|
|
||||||
split_commits = false
|
|
||||||
# regex for preprocessing the commit messages
|
|
||||||
commit_preprocessors = [
|
|
||||||
# Replace issue numbers
|
|
||||||
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
|
|
||||||
# Check spelling of the commit with https://github.com/crate-ci/typos
|
|
||||||
# If the spelling is incorrect, it will be automatically fixed.
|
|
||||||
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
|
|
||||||
]
|
|
||||||
# regex for parsing and grouping commits
|
|
||||||
commit_parsers = [
|
|
||||||
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
|
|
||||||
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
|
|
||||||
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
|
|
||||||
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
|
|
||||||
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
|
||||||
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
|
||||||
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
|
||||||
{ message = "^chore\\(changelog\\)", skip = true },
|
|
||||||
{ message = "^chore\\(version\\)", skip = true },
|
|
||||||
{ message = "^chore\\(release\\): prepare for", skip = true },
|
|
||||||
{ message = "^chore\\(deps.*\\)", skip = true },
|
|
||||||
{ message = "^chore\\(pr\\)", skip = true },
|
|
||||||
{ message = "^chore\\(pull\\)", skip = true },
|
|
||||||
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
|
|
||||||
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
|
||||||
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
|
|
||||||
{ message = ".*", group = "<!-- 10 -->💼 Other" },
|
|
||||||
]
|
|
||||||
# Regex to select git tags that represent releases.
|
|
||||||
tag_pattern = "v[0-9]+\\.[0-9]+\\.[0-9]+"
|
|
||||||
# filter out the commits that are not matched by commit parsers
|
|
||||||
filter_commits = false
|
|
||||||
# sort the tags topologically
|
|
||||||
topo_order = false
|
|
||||||
# sort the commits inside sections by oldest/newest order
|
|
||||||
sort_commits = "newest"
|
|
||||||
34
dist/main.js
vendored
Normal file
34
dist/main.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
const cp = require("child_process");
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
function run(script) {
|
||||||
|
cp.execFileSync(script, { stdio: "inherit", shell: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportOutput(key, value) {
|
||||||
|
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${key}=${value}\n`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setEnv(key, value) {
|
||||||
|
fs.appendFileSync(process.env.GITHUB_ENV, `${key}=${value}\n`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
const script = path.join(__dirname, "..", "scripts", "detect-version-change.sh");
|
||||||
|
|
||||||
|
|
||||||
|
run(script);
|
||||||
|
|
||||||
|
// Hier nehmen wir an, dass das Script selbst bereits `version_changed=true/false`
|
||||||
|
// in $GITHUB_OUTPUT geschrieben hat.
|
||||||
|
// Zur Sicherheit lesen wir das nochmal aus und speichern es auch als release-Flag.
|
||||||
|
const output = fs.readFileSync(process.env.GITHUB_OUTPUT, "utf-8");
|
||||||
|
const match = output.match(/^version_changed=(.*)$/m);
|
||||||
|
const value = match?.[1]?.trim() || "false";
|
||||||
|
|
||||||
|
exportOutput("release", value);
|
||||||
|
setEnv("VERSION_CHANGED", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
42
dist/post.js
vendored
Normal file
42
dist/post.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
const cp = require("child_process");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
function run(script, args = []) {
|
||||||
|
const cmd = typeof script === "string" ? script : script.join(" ");
|
||||||
|
cp.execSync(cmd, {
|
||||||
|
stdio: "inherit",
|
||||||
|
shell: true,
|
||||||
|
env: process.env,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function scriptPath(...segments) {
|
||||||
|
return path.join(__dirname, "..", "scripts", ...segments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
const versionChanged = (process.env.VERSION_CHANGED || "false").toLowerCase() === "true";
|
||||||
|
|
||||||
|
const readCliffScript = scriptPath("read-cliff-version.sh");
|
||||||
|
const cliffVersion = cp
|
||||||
|
.execSync(readCliffScript, { encoding: "utf-8", shell: true })
|
||||||
|
.trim()
|
||||||
|
.split("\n")
|
||||||
|
.pop();
|
||||||
|
|
||||||
|
run(scriptPath("install-git-cliff.sh") + " " + cliffVersion);
|
||||||
|
|
||||||
|
run(
|
||||||
|
scriptPath("setup-git.sh") +
|
||||||
|
` "${process.env.INPUT_AUTHOR_NAME}" "${process.env.INPUT_AUTHOR_EMAIL}"`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (versionChanged) {
|
||||||
|
process.env.RELEASE_PUBLISH_TOKEN = process.env.INPUT_TOKEN || "";
|
||||||
|
run(scriptPath("release-from-version.sh"));
|
||||||
|
} else {
|
||||||
|
run(scriptPath("generate-unreleased-changelog.sh"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import json
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import re
|
|
||||||
|
|
||||||
def extract_type(raw_message: str) -> str | None:
|
|
||||||
m = re.match(r"^(\w+)(?:\([^)]+\))?:", raw_message.strip())
|
|
||||||
return m.group(1) if m else None
|
|
||||||
|
|
||||||
def git_commits_between(parent, merge):
|
|
||||||
"""Return list of commit hashes between parent and merge (exclusive of parent, inclusive of merge)."""
|
|
||||||
out = subprocess.check_output(
|
|
||||||
["git", "rev-list", f"{parent}..{merge}", "--no-merges"],
|
|
||||||
text=True
|
|
||||||
)
|
|
||||||
return [line.strip() for line in out.splitlines() if line.strip()]
|
|
||||||
|
|
||||||
def load_context(path=None):
|
|
||||||
if path:
|
|
||||||
with open(path) as f:
|
|
||||||
return json.load(f)
|
|
||||||
else:
|
|
||||||
return json.load(sys.stdin)
|
|
||||||
|
|
||||||
def main(path=None):
|
|
||||||
context = load_context(path)
|
|
||||||
commits = context[0]["commits"]
|
|
||||||
commits_by_id = {c["id"]: c for c in commits}
|
|
||||||
|
|
||||||
new_commits = []
|
|
||||||
consumed = set()
|
|
||||||
|
|
||||||
for c in commits:
|
|
||||||
if c.get("merge_commit"):
|
|
||||||
parents = subprocess.check_output(
|
|
||||||
["git", "rev-list", "--parents", "-n", "1", c["id"]],
|
|
||||||
text=True
|
|
||||||
).strip().split()
|
|
||||||
merge_id, *parent_ids = parents
|
|
||||||
|
|
||||||
parent_type = extract_type(c["raw_message"])
|
|
||||||
|
|
||||||
if len(parent_ids) >= 2:
|
|
||||||
mainline = parent_ids[0]
|
|
||||||
children_ids = git_commits_between(mainline, merge_id)
|
|
||||||
|
|
||||||
children = []
|
|
||||||
for cid in children_ids:
|
|
||||||
if cid in commits_by_id:
|
|
||||||
child = commits_by_id[cid]
|
|
||||||
child_type = extract_type(child["raw_message"])
|
|
||||||
if child_type and parent_type and child_type != parent_type:
|
|
||||||
if not child.get("extra") or not isinstance(child["extra"], dict):
|
|
||||||
child["extra"] = {}
|
|
||||||
child["extra"]["mismatch_type"] = child_type
|
|
||||||
children.append(child)
|
|
||||||
consumed.add(cid)
|
|
||||||
|
|
||||||
if not c.get("extra") or not isinstance(c["extra"], dict):
|
|
||||||
c["extra"] = {}
|
|
||||||
c["extra"]["children"] = children
|
|
||||||
|
|
||||||
new_commits.append(c)
|
|
||||||
|
|
||||||
filtered = [c for c in new_commits if c["id"] not in consumed]
|
|
||||||
context[0]["commits"] = filtered
|
|
||||||
|
|
||||||
json.dump(context, sys.stdout, indent=4)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main(sys.argv[1] if len(sys.argv) > 1 else None)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
CLIFF_CONFIG="cliff.toml"
|
|
||||||
|
|
||||||
# Check if cliff.toml exists, if not, copy cliff.toml.template from the Action
|
|
||||||
if [ ! -f "$CLIFF_CONFIG" ]; then
|
|
||||||
echo "cliff.toml not found, using template from action."
|
|
||||||
cp "${GITHUB_ACTION_PATH:-${github_action_path:-${{ github.action_path }}}}/cliff.toml.template" "$CLIFF_CONFIG"
|
|
||||||
# Replace placeholders in the copied config
|
|
||||||
OWNER="${GITHUB_REPOSITORY%/*}"
|
|
||||||
REPO="${GITHUB_REPOSITORY#*/}"
|
|
||||||
sed -i "s/owner = \"%OWNER%\"/owner = \"$OWNER\"/g" "$CLIFF_CONFIG"
|
|
||||||
sed -i "s/repo = \"%REPO%\"/repo = \"$REPO\"/g" "$CLIFF_CONFIG"
|
|
||||||
fi
|
|
||||||
@@ -8,9 +8,7 @@ GIT_BRANCH="${GITHUB_REF##refs/heads/}"
|
|||||||
# === Step 1: Generate Changelog (only if file exists or on main) ===
|
# === Step 1: Generate Changelog (only if file exists or on main) ===
|
||||||
if [[ -f "$CHANGELOG_FILE" || "$GIT_BRANCH" == "main" ]]; then
|
if [[ -f "$CHANGELOG_FILE" || "$GIT_BRANCH" == "main" ]]; then
|
||||||
echo "📄 Generating $CHANGELOG_FILE using git-cliff..."
|
echo "📄 Generating $CHANGELOG_FILE using git-cliff..."
|
||||||
git-cliff -c "$CLIFF_CONFIG" --context \
|
git-cliff -c "$CLIFF_CONFIG" -o "$CHANGELOG_FILE"
|
||||||
| "${GITHUB_ACTION_PATH}/scripts/augment_context.py" \
|
|
||||||
| git-cliff -c "$CLIFF_CONFIG" --from-context - -o "$CHANGELOG_FILE"
|
|
||||||
else
|
else
|
||||||
echo "ℹ️ $CHANGELOG_FILE does not exist and branch is not 'main'. Skipping generation."
|
echo "ℹ️ $CHANGELOG_FILE does not exist and branch is not 'main'. Skipping generation."
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,11 +7,7 @@ set -euo pipefail
|
|||||||
REPO="orhun/git-cliff"
|
REPO="orhun/git-cliff"
|
||||||
ARCH_OS="x86_64-unknown-linux-gnu"
|
ARCH_OS="x86_64-unknown-linux-gnu"
|
||||||
INSTALL_DIR="/usr/local/bin"
|
INSTALL_DIR="/usr/local/bin"
|
||||||
if [[ -z "${1:-}" ]]; then
|
VERSION="${1:-latest}"
|
||||||
VERSION="latest"
|
|
||||||
else
|
|
||||||
VERSION="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
need() { command -v "$1" >/dev/null || { echo "$1 is missing"; exit 1; }; }
|
need() { command -v "$1" >/dev/null || { echo "$1 is missing"; exit 1; }; }
|
||||||
need curl; need tar; need grep; need sed; need awk; need jq
|
need curl; need tar; need grep; need sed; need awk; need jq
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# install-python.sh – installs the latest Python version through apt
|
|
||||||
# Usage: sudo ./install-python.sh
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
if command -v python3 >/dev/null 2>&1; then
|
|
||||||
echo "ℹ️ Python $(python3 --version) is already installed"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt update
|
|
||||||
apt install -y python3
|
|
||||||
|
|
||||||
echo "✅ Python $(python3 --version) installed"
|
|
||||||
@@ -5,16 +5,18 @@ CLIFF_TOML="${1:-cliff.toml}"
|
|||||||
|
|
||||||
if [[ ! -f "$CLIFF_TOML" ]]; then
|
if [[ ! -f "$CLIFF_TOML" ]]; then
|
||||||
echo "❌ File not found: $CLIFF_TOML" >&2
|
echo "❌ File not found: $CLIFF_TOML" >&2
|
||||||
|
echo "version=" >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION_LINE=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' "$CLIFF_TOML" || true)
|
VERSION_LINE=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' "$CLIFF_TOML" || true)
|
||||||
|
|
||||||
if [[ -n "$VERSION_LINE" ]]; then
|
if [[ -n "$VERSION_LINE" ]]; then
|
||||||
echo "✅ Extracted CLIFF_VERSION: $VERSION_LINE"
|
echo "✅ Extracted CLIFF_VERSION: $VERSION_LINE" >&2
|
||||||
else
|
else
|
||||||
echo "⚠️ No CLIFF_VERSION found in $CLIFF_TOML"
|
echo "⚠️ No CLIFF_VERSION found in $CLIFF_TOML" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Output für GitHub Actions / Composite Action
|
|
||||||
echo "version=${VERSION_LINE:-}" >> "$GITHUB_OUTPUT"
|
echo "version=${VERSION_LINE:-}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "$VERSION_LINE"
|
||||||
|
n
|
||||||
@@ -64,9 +64,7 @@ echo "📦 Version: $VERSION"
|
|||||||
|
|
||||||
# === Step 2: Generate changelog for release ===
|
# === Step 2: Generate changelog for release ===
|
||||||
echo "📄 Generating changelog for tag v$VERSION"
|
echo "📄 Generating changelog for tag v$VERSION"
|
||||||
git-cliff -c "$CLIFF_CONFIG" -t "v$VERSION" --context \
|
git-cliff -c "$CLIFF_CONFIG" -t "v$VERSION" -o "$CHANGELOG_FILE"
|
||||||
| "${GITHUB_ACTION_PATH}/scripts/augment_context.py" \
|
|
||||||
| git-cliff -c "$CLIFF_CONFIG" -t "v$VERSION" --from-context - -o "$CHANGELOG_FILE"
|
|
||||||
|
|
||||||
ESCAPED_VERSION="$(echo "$VERSION" | sed 's/\./\\./g')"
|
ESCAPED_VERSION="$(echo "$VERSION" | sed 's/\./\\./g')"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user