mirror of
https://github.com/dtzp555-max/ocp.git
synced 2026-07-26 23:45:08 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79656b485f | ||
|
|
66096cdcab |
@@ -21,24 +21,31 @@ jobs:
|
|||||||
- name: Extract CHANGELOG section
|
- name: Extract CHANGELOG section
|
||||||
id: notes
|
id: notes
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
VERSION="${{ steps.ver.outputs.version }}"
|
VERSION="${{ steps.ver.outputs.version }}"
|
||||||
|
NOTES=/tmp/release-notes.md
|
||||||
# Extract section for this version from CHANGELOG.md
|
# Extract section for this version from CHANGELOG.md
|
||||||
# Pattern: "## v${VERSION}" through the next "## " or EOF
|
# Pattern: "## v${VERSION}" through the next "## " or EOF
|
||||||
if [ ! -f CHANGELOG.md ]; then
|
if [ ! -f CHANGELOG.md ]; then
|
||||||
echo "No CHANGELOG.md found; using minimal release notes"
|
echo "No CHANGELOG.md found; using minimal release notes"
|
||||||
echo "notes=Release v${VERSION}" >> $GITHUB_OUTPUT
|
# MUST write the file, not just an output: the create step consumes a FILE, so an
|
||||||
|
# early exit here used to leave --notes-file pointing at a path that never existed,
|
||||||
|
# turning "degrade to minimal notes" into a failed release job (#202).
|
||||||
|
echo "Release v${VERSION}" > "$NOTES"
|
||||||
|
echo "notes_file=$NOTES" >> $GITHUB_OUTPUT
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
awk -v ver="v${VERSION}" '
|
awk -v ver="v${VERSION}" '
|
||||||
$0 ~ "^## " ver { found=1; print; next }
|
$0 ~ "^## " ver { found=1; print; next }
|
||||||
found && /^## v/ { exit }
|
found && /^## v/ { exit }
|
||||||
found { print }
|
found { print }
|
||||||
' CHANGELOG.md > /tmp/release-notes.md
|
' CHANGELOG.md > "$NOTES"
|
||||||
if [ ! -s /tmp/release-notes.md ]; then
|
if [ ! -s "$NOTES" ]; then
|
||||||
echo "No matching section in CHANGELOG for v${VERSION}; using minimal notes"
|
echo "No matching section in CHANGELOG for v${VERSION}; using minimal notes"
|
||||||
echo "Release v${VERSION}" > /tmp/release-notes.md
|
echo "Release v${VERSION}" > "$NOTES"
|
||||||
fi
|
fi
|
||||||
echo "notes_file=/tmp/release-notes.md" >> $GITHUB_OUTPUT
|
echo "--- release notes (${VERSION}) ---"; cat "$NOTES"
|
||||||
|
echo "notes_file=$NOTES" >> $GITHUB_OUTPUT
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -49,5 +56,5 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
gh release create "v${{ steps.ver.outputs.version }}" \
|
gh release create "v${{ steps.ver.outputs.version }}" \
|
||||||
--title "v${{ steps.ver.outputs.version }}" \
|
--title "v${{ steps.ver.outputs.version }}" \
|
||||||
--notes-file /tmp/release-notes.md \
|
--notes-file "${{ steps.notes.outputs.notes_file }}" \
|
||||||
--latest
|
--latest
|
||||||
|
|||||||
Reference in New Issue
Block a user