docs: update release notes pattern to use sparse-checkout
Replace full checkout + find scan with sparse-checkout for RELEASE_NOTES.md — faster and simpler.
This commit is contained in:
+10
-7
@@ -633,7 +633,7 @@ git push origin v0.2.0-alpha.1
|
||||
|
||||
### 8.1. Release Notes from File
|
||||
|
||||
Instead of hardcoding release notes in the workflow, keep a `RELEASE_NOTES.md` in the repo. The CI scans for it and prepends its content to the auto-generated Downloads section.
|
||||
Instead of hardcoding release notes in the workflow, keep a `RELEASE_NOTES.md` in the repo root. The CI fetches only that file (via sparse-checkout for speed) and prepends its content to the auto-generated Downloads section.
|
||||
|
||||
**Workflow:**
|
||||
1. Before tagging, write `RELEASE_NOTES.md` with changes for this release
|
||||
@@ -643,16 +643,17 @@ Instead of hardcoding release notes in the workflow, keep a `RELEASE_NOTES.md` i
|
||||
**CI implementation:**
|
||||
|
||||
```yaml
|
||||
- name: Checkout
|
||||
- name: Fetch RELEASE_NOTES.md only
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: RELEASE_NOTES.md
|
||||
sparse-checkout-cone-mode: false
|
||||
|
||||
- name: Create release
|
||||
run: |
|
||||
# Scan for RELEASE_NOTES.md (repo root first, then up to 3 levels deep)
|
||||
NOTES_FILE=$(find . -maxdepth 3 -name "RELEASE_NOTES.md" -type f | head -1)
|
||||
if [ -n "$NOTES_FILE" ]; then
|
||||
export RELEASE_NOTES=$(cat "$NOTES_FILE")
|
||||
echo "Found release notes: $NOTES_FILE"
|
||||
if [ -f RELEASE_NOTES.md ]; then
|
||||
export RELEASE_NOTES=$(cat RELEASE_NOTES.md)
|
||||
echo "Found RELEASE_NOTES.md"
|
||||
else
|
||||
export RELEASE_NOTES=""
|
||||
echo "No RELEASE_NOTES.md found"
|
||||
@@ -673,6 +674,8 @@ Instead of hardcoding release notes in the workflow, keep a `RELEASE_NOTES.md` i
|
||||
curl -s -X POST ... -d "{\"body\": $BODY_JSON, ...}"
|
||||
```
|
||||
|
||||
> **Why sparse-checkout?** The `create-release` job only needs one file. A sparse-checkout skips downloading the full repo history and working tree, making the step significantly faster — especially in repos with large static assets or many files.
|
||||
|
||||
If `RELEASE_NOTES.md` is absent, the release uses only the auto-generated Downloads section — no manual notes needed for quick pre-releases.
|
||||
|
||||
## 9. Gitea vs GitHub Actions Differences
|
||||
|
||||
Reference in New Issue
Block a user