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
1111jobs :
1212 build-and-commit :
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,44 @@ 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+ # A pandoc bug?
77+ TITLE_LINE=$(head -n 1 "$INPUT_FILE" | sed 's/^=/#/')
78+ sed -i "1i${TITLE_LINE}\n" "$MARKDOWN_FILE"
79+ done
6680
6781 - name : Deploy to release-notes-build branch
6882 env :
7589 gh auth setup-git
7690 git checkout --orphan release-notes-build
7791 git add .
78- git commit -m "Generate Release Notes for ${{ inputs.version }} "
92+ git commit -m "Generate Release Notes"
7993 git remote add origin "https://github.com/${{ github.repository }}.git"
8094 git push -f origin release-notes-build
0 commit comments