Skip to content

Commit 879c0cf

Browse files
committed
generate-release-notes: Generate RN for all versions found by default
Allow for specifying a version on input.
1 parent 1e03fbb commit 879c0cf

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed

.github/workflows/generate-release-notes.yml

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'The release version (e.g., v2.13)'
8-
required: true
9-
default: 'v2.13'
7+
description: 'The patch version (e.g., v2.13.1)'
8+
required: false
9+
default: ''
1010

1111
jobs:
1212
build-and-commit:
@@ -15,9 +15,6 @@ jobs:
1515
contents: write # Needed to push to branch
1616
env:
1717
VERSION: ${{ inputs.version }}
18-
INPUT_FILE: versions/${{ inputs.version }}/modules/en/pages/release-notes/${{ inputs.version }}.adoc
19-
XML_FILE: release-notes-build/${{ inputs.version }}.xml
20-
MARKDOWN_FILE: release-notes-build/${{ inputs.version }}.md
2118

2219
steps:
2320
- name: Checkout code
@@ -42,27 +39,43 @@ jobs:
4239
- name: Create release notes build directory
4340
run: mkdir release-notes-build
4441

45-
- name: Convert AsciiDoc to DocBook
42+
- name: Generate Release Notes
4643
run: |
47-
if [ ! -f "$INPUT_FILE" ]; then
48-
echo "Error: Input file $INPUT_FILE not found."
49-
exit 1
44+
if [ -n "$VERSION" ]; then
45+
# Extract major.minor for directory (e.g. v2.13.1 -> v2.13)
46+
VERSION_DIR=$(echo "$VERSION" | cut -d. -f1,2)
47+
FILES="versions/$VERSION_DIR/modules/en/pages/release-notes/$VERSION.adoc"
48+
else
49+
FILES=$(find versions -type f -path "versions/*/modules/en/pages/release-notes/v*.adoc")
5050
fi
5151
52-
asciidoctor -v -a build-type=community -b docbook5 -o "$XML_FILE" "$INPUT_FILE"
52+
for INPUT_FILE in $FILES; do
53+
if [ ! -f "$INPUT_FILE" ]; then
54+
if [ -n "$VERSION" ]; then
55+
echo "Error: Input file $INPUT_FILE not found."
56+
exit 1
57+
fi
58+
continue
59+
fi
5360
54-
- name: Convert DocBook to GitHub-Flavored Markdown
55-
run: |
56-
pandoc -v
57-
pandoc --from docbook \
58-
--to gfm \
59-
--output "$MARKDOWN_FILE" \
60-
"$XML_FILE"
61+
BASENAME=$(basename "$INPUT_FILE" .adoc)
62+
XML_FILE="release-notes-build/${BASENAME}.xml"
63+
MARKDOWN_FILE="release-notes-build/${BASENAME}.md"
6164
62-
- name: Add title to release notes
63-
run: |
64-
TITLE_LINE=$(head -n 1 "$INPUT_FILE" | sed 's/^=/#/')
65-
sed -i "1i${TITLE_LINE}\n" "$MARKDOWN_FILE"
65+
# Convert AsciiDoc to DocBook
66+
asciidoctor -v -a build-type=community -b docbook5 -o "$XML_FILE" "$INPUT_FILE"
67+
68+
# Convert DocBook to GitHub-Flavored Markdown
69+
pandoc -v
70+
pandoc --from docbook \
71+
--to gfm \
72+
--output "$MARKDOWN_FILE" \
73+
"$XML_FILE"
74+
75+
# Re-add title to release notes
76+
TITLE_LINE=$(head -n 1 "$INPUT_FILE" | sed 's/^=/#/')
77+
sed -i "1i${TITLE_LINE}\n" "$MARKDOWN_FILE"
78+
done
6679
6780
- name: Deploy to release-notes-build branch
6881
env:
@@ -75,6 +88,6 @@ jobs:
7588
gh auth setup-git
7689
git checkout --orphan release-notes-build
7790
git add .
78-
git commit -m "Generate Release Notes for ${{ inputs.version }}"
91+
git commit -m "Generate Release Notes"
7992
git remote add origin "https://github.com/${{ github.repository }}.git"
8093
git push -f origin release-notes-build

0 commit comments

Comments
 (0)