Files
GiteaMailTemplates/.github/workflows/gitea-tracker.yml
T
KenanZhuandClaude 5648f73d45 refactor(ci): use marker comments instead of regex for tracker workflow
Add TRACKER: HTML comment markers to COMPATIBILITY.md, README.md, and
all 5 translation READMEs. Rewrite gitea-tracker.yml to use grep -n
for precise line-based insertion and sed line-address editing.

Markers introduced:
- TRACKER:QUICK-REF-MAX  — Quick Reference max tested version
- TRACKER:VERSION-INSERT — Version History row insertion point
- TRACKER:LATEST-VERIFIED — latest verified note version
- TRACKER:BADGE — shields.io badge version
- TRACKER:LATEST-TESTED — latest tested version in READMEs

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-23 10:34:43 +08:00

127 lines
5.4 KiB
YAML

name: Gitea Version Tracker
on:
schedule:
# Daily at 08:00 UTC — check for new Gitea releases
- cron: '0 8 * * *'
workflow_dispatch:
inputs:
version:
description: 'Gitea version (e.g. 1.27.0) — leave empty to auto-detect'
required: false
jobs:
track:
name: Track Gitea Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Determine latest Gitea version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
NEW_VERSION="${{ github.event.inputs.version }}"
else
# Fetch latest release from Gitea API
RELEASE_JSON=$(curl -sSf https://gitea.com/api/v1/repos/gitea/gitea/releases/latest)
NEW_VERSION=$(echo "$RELEASE_JSON" | jq -r '.tag_name')
fi
echo "New Gitea version: $NEW_VERSION"
# Read current max-tested from the TRACKER:QUICK-REF-MAX marker line above it
MARKER_LINE=$(grep -n 'TRACKER:QUICK-REF-MAX' COMPATIBILITY.md | cut -d: -f1)
CURRENT=$(sed -n "$((MARKER_LINE - 1))p" COMPATIBILITY.md | grep -oP '\*\*[0-9.]+\*\*' | tail -1 | tr -d '*')
echo "Current max tested: $CURRENT"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "current_version=$CURRENT" >> $GITHUB_OUTPUT
if [ "$NEW_VERSION" = "$CURRENT" ]; then
echo "No new Gitea release detected. Skipping."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "New version detected: $CURRENT → $NEW_VERSION"
echo "skip=false" >> $GITHUB_OUTPUT
fi
# --- COMPATIBILITY.md ---
- name: COMPATIBILITY.md — Quick Reference (max tested version)
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
# The Quick Reference row is the line directly above TRACKER:QUICK-REF-MAX
MARKER=$(grep -n 'TRACKER:QUICK-REF-MAX' COMPATIBILITY.md | cut -d: -f1)
TARGET=$((MARKER - 1))
# Replace the last **X.Y.Z** in that line with the new version
sed -i "${TARGET}s/\*\*[0-9.]*\*\* | ✅/**${NEW}** | ✅/" COMPATIBILITY.md
- name: COMPATIBILITY.md — Version History table
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
TODAY=$(date +%Y-%m-%d)
# Insert a new row right after TRACKER:VERSION-INSERT marker
MARKER=$(grep -n 'TRACKER:VERSION-INSERT' COMPATIBILITY.md | cut -d: -f1)
ROW="| **${NEW}** | ${TODAY} | ⏳ Pending Verification | TBD |"
sed -i "${MARKER}a ${ROW}" COMPATIBILITY.md
- name: COMPATIBILITY.md — latest verified note
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
# Update version inline on the line with TRACKER:LATEST-VERIFIED
sed -i "/TRACKER:LATEST-VERIFIED/s/Gitea [0-9.]*/Gitea ${NEW}/" COMPATIBILITY.md
# --- README.md ---
- name: README.md — badge and latest tested
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
# Badge: update version on the TRACKER:BADGE line
sed -i "/TRACKER:BADGE/s/tested\)-[0-9a-z.]*\(blue\)/tested\)-${NEW}\2/" README.md
# Latest tested: update version on the TRACKER:LATEST-TESTED line
sed -i "/TRACKER:LATEST-TESTED/s/Gitea [0-9.]*/Gitea ${NEW}/" README.md
# --- Translation READMEs ---
- name: README translations — latest tested
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
for f in docs/README.{ja,ko,ru,zh-CN,zh-TW}.md; do
sed -i "/TRACKER:LATEST-TESTED/s/Gitea [0-9.]*/Gitea ${NEW}/" "$f"
done
# --- Create PR ---
- name: Create Pull Request
if: steps.version.outputs.skip != 'true'
uses: peter-evans/create-pull-request@v7
with:
branch: track/gitea-${{ steps.version.outputs.new_version }}
commit-message: "docs: track Gitea ${{ steps.version.outputs.new_version }} — pending verification"
title: "⬆️ Track Gitea ${{ steps.version.outputs.new_version }} — ⏳ Pending Verification"
body: |
Gitea **${{ steps.version.outputs.new_version }}** has been released.
This PR:
- Updates the compatibility matrix in `COMPATIBILITY.md`
- Updates version badges in `README.md` and translations
- Marks the new version as **⏳ Pending Verification**
## Verification Checklist
- [ ] Check [Gitea changelog](https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md) for mail template changes
- [ ] Review diff of official templates: `git diff v${{ steps.version.outputs.current_version }}..v${{ steps.version.outputs.new_version }} -- templates/mail/ services/mailer/`
- [ ] Run `cd tools && go run . preview all` to confirm templates still render
- [ ] Update status from ⏳ to ✅ (compatible) or ❌ (breaking) in COMPATIBILITY.md
- [ ] Update the `Mail Template Changes` and `Breaking?` columns with accurate notes
labels: compatibility, automated
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}