From dc52347ed014d826ca3e013469338674ae41911f Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 30 Sep 2026 20:05:28 +0800 Subject: [PATCH 1/2] ci: include maintained changes in release notes --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4c9ce92b..5b5a59572 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,6 +42,7 @@ jobs: uses: actions/checkout@v5 with: ref: ${{ inputs.source_ref || inputs.release_tag || github.ref }} + fetch-depth: 0 - name: Set up Node.js uses: actions/setup-node@v5 @@ -111,10 +112,50 @@ jobs: sha256sum * > SHA256SUMS.txt ) + - name: Prepare release notes + shell: bash + run: | + set -euo pipefail + + notes_file="$RUNNER_TEMP/codex2api-release-notes.md" + version="$VERSION" + previous_tag="$(git tag --sort=-version:refname \ + | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \ + | grep -Fxv "$version" \ + | head -n 1 || true)" + + awk ' + /^## Custom maintenance$/ { in_section=1 } + in_section && /^## / && $0 != "## Custom maintenance" { exit } + in_section { print } + ' README.md > "$notes_file" + + printf '\n---\n\n' >> "$notes_file" + awk ' + /^## 自定义维护内容$/ { in_section=1 } + in_section && /^## / && $0 != "## 自定义维护内容" { exit } + in_section { print } + ' README.zh-CN.md >> "$notes_file" + + printf '\n## Custom changes in this release\n\n' >> "$notes_file" + custom_commits="" + if [[ -n "$previous_tag" ]]; then + custom_commits="$(git log --first-parent --format='- %s' \ + "$previous_tag..$SOURCE_REF" -- \ + ':!CHANGELOG.md' ':!docs/**' ':!.github/**' \ + | grep -Ev '^- (Merge pull request|chore: sync upstream release|ci:)' || true)" + fi + if [[ -n "$custom_commits" ]]; then + printf '%s\n' "$custom_commits" >> "$notes_file" + else + printf '%s\n' '- No additional custom code changes were recorded for this release.' >> "$notes_file" + fi + - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: tag_name: ${{ inputs.release_tag || github.ref_name }} + body_path: ${{ runner.temp }}/codex2api-release-notes.md generate_release_notes: true files: | dist/*.tar.gz From 3e3827c52e020d62f8346f8a1c478a5bfa669cba Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 30 Sep 2026 20:07:34 +0800 Subject: [PATCH 2/2] ci: read release maintenance notes from main --- .github/workflows/release.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b5a59572..80873d637 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,24 +118,29 @@ jobs: set -euo pipefail notes_file="$RUNNER_TEMP/codex2api-release-notes.md" + homepage_readme="$RUNNER_TEMP/codex2api-homepage-readme.md" + homepage_readme_zh="$RUNNER_TEMP/codex2api-homepage-readme-zh.md" version="$VERSION" previous_tag="$(git tag --sort=-version:refname \ | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \ | grep -Fxv "$version" \ | head -n 1 || true)" + git show origin/main:README.md > "$homepage_readme" + git show origin/main:README.zh-CN.md > "$homepage_readme_zh" + awk ' /^## Custom maintenance$/ { in_section=1 } in_section && /^## / && $0 != "## Custom maintenance" { exit } in_section { print } - ' README.md > "$notes_file" + ' "$homepage_readme" > "$notes_file" printf '\n---\n\n' >> "$notes_file" awk ' /^## 自定义维护内容$/ { in_section=1 } in_section && /^## / && $0 != "## 自定义维护内容" { exit } in_section { print } - ' README.zh-CN.md >> "$notes_file" + ' "$homepage_readme_zh" >> "$notes_file" printf '\n## Custom changes in this release\n\n' >> "$notes_file" custom_commits=""