File tree Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Original file line number Diff line number Diff line change 1+ name : " Publish Versioned API Reference Wiki page"
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v[0-9]+.[0-9]+.[0-9]+'
7+
8+ jobs :
9+ publish-versioned-api-reference :
10+ name : Publish Versioned API Reference Wiki
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout operator codebase
15+ uses : actions/checkout@v2
16+ with :
17+ path : cluster-operator
18+ - name : Get the version
19+ id : get_version
20+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
21+ - name : Checkout wiki codebase
22+ uses : actions/checkout@v2
23+ with :
24+ repository : ${{ github.repository }}.wiki
25+ path : wiki
26+ - name : Push to wiki
27+ run : |
28+ cd wiki
29+ git config --local user.email "[email protected] " 30+ git config --local user.name "github-actions"
31+ # Add the versioned API Reference to the Wiki
32+ cp ../cluster-operator/docs/api/rabbitmq.com.ref.asciidoc ./API_Reference_${{ steps.get_version.outputs.VERSION }}.asciidoc
33+ # Regenerate the ordered list of API Reference docs for the sidebar
34+ export REGENERATED_SIDEBAR="$(../cluster-operator/hack/generate-ordered-api-reference-list.sh .)"
35+ echo "$REGENERATED_SIDEBAR" > Wiki_Sidebar.md
36+ git add ./API_Reference_${{ steps.get_version.outputs.VERSION }}.asciidoc
37+ git add ./Wiki_Sidebar.md
38+ git commit -m "Publish version ${{ steps.get_version.outputs.VERSION }} API Reference" && git push
Original file line number Diff line number Diff line change 1- name : " Update API Reference Wiki page"
1+ name : " Update Latest API Reference Wiki page"
22
33on :
44 push :
55 branches : [ main ]
66
77jobs :
88 update-api-reference :
9- name : Update API Reference Wiki
9+ name : Update Latest API Reference Wiki
1010 runs-on : ubuntu-latest
1111
1212 steps :
2424 cd wiki
2525 git config --local user.email "[email protected] " 2626 git config --local user.name "github-actions"
27+ # Update the latest API Reference Doc
2728 cp ../cluster-operator/docs/api/rabbitmq.com.ref.asciidoc ./API_Reference.asciidoc
28- git add .
29- git diff-index --quiet HEAD || git commit -m "Update API Reference" && git push
29+ git add ./API_Reference.asciidoc
30+ git diff-index --quiet HEAD || git commit -m "Update Latest API Reference" && git push
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ wikiDir=$1
6+
7+ generateVersionedEntry () {
8+ echo " * [$1 ](https://github.com/rabbitmq/cluster-operator/wiki/API_Reference_$1 )"
9+ }
10+
11+ generateLatestEntry () {
12+ echo " * [Latest](https://github.com/rabbitmq/cluster-operator/wiki/API_Reference)"
13+ }
14+
15+ lead=' ^<!--- BEGIN API REFERENCE LIST -->$'
16+ tail=' ^<!--- END API REFERENCE LIST -->$'
17+
18+ unorderedlistfile=" $( mktemp) "
19+ orderedlistfile=" $( mktemp) "
20+
21+ apiVersions=" $( find $wikiDir /API_Reference_* -printf " %f\n" | sed -r ' s/API_Reference_(v[0-9]+.[0-9]+.[0-9]+).asciidoc/\1/' | sort -Vr ) "
22+ for version in $apiVersions
23+ do
24+ echo " $( generateVersionedEntry $version ) " >> $unorderedlistfile
25+ done
26+
27+ # Latest API version is a special case, that is always top of the list
28+ generateLatestEntry > $orderedlistfile
29+ cat $unorderedlistfile >> $orderedlistfile
30+
31+ sed -e " /$lead /,/$tail /{ /$lead /{p; r $orderedlistfile
32+ }; /$tail /p; d }" " $wikiDir /Wiki_Sidebar.md"
You can’t perform that action at this time.
0 commit comments