1
0

docs-add-version-picker.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. name: Add Version Picker (RUN ONCE)
  2. on:
  3. workflow_dispatch:
  4. jobs:
  5. add-version-picker:
  6. name: Add Version Picker
  7. runs-on: ubuntu-latest
  8. steps:
  9. - uses: actions/checkout@v4
  10. - name: Configure Git
  11. run: |
  12. git config user.email "action@synapse.bot.com"
  13. git config user.name "Action Bot"
  14. env:
  15. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  16. - name: Setup mdbook
  17. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  18. with:
  19. mdbook-version: '0.4.17'
  20. - name: Copy files to release branches
  21. run: |
  22. for version in "v1.98" "v1.97" "v1.96" "v1.95" "v1.94" "v1.93" "v1.92" "v1.91" "v1.90" "v1.89" "v1.88" "v1.87" "v1.86" "v1.85" "v1.84" "v1.83" "v1.82" "v1.81" "v1.80" "v1.79" "v1.78" "v1.77" "v1.76" "v1.75" "v1.74" "v1.73" "v1.72" "v1.71" "v1.70" "v1.69" "v1.68" "v1.67" "v1.66" "v1.65" "v1.64" "v1.63" "v1.62" "v1.61" "v1.60" "v1.59" "v1.58" "v1.57" "v1.56" "v1.55" "v1.54" "v1.53" "v1.52" "v1.51" "v1.50" "v1.49" "v1.48" "v1.47" "v1.46" "v1.45" "v1.44" "v1.43" "v1.42" "v1.41" "v1.40" "v1.39" "v1.38" "v1.37"
  23. do
  24. git fetch
  25. git checkout -b release-$version origin/release-$version
  26. git checkout develop -- ./book.toml
  27. git checkout develop -- ./docs/website_files/version-picker.js
  28. git checkout develop -- ./docs/website_files/version-picker.css
  29. git checkout develop -- ./docs/website_files/README.md
  30. echo "window.SYNAPSE_VERSION = '$version';" > ./docs/website_files/version.js
  31. # Adding version-picker element to index.hbs
  32. awk '/<button id="search-toggle" class="icon-button" type="button" title="Search. \(Shortkey: s\)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">/{
  33. print; getline; print; getline; print; getline; print;
  34. print "\
  35. <div class=\"version-picker\">\n\
  36. <div class=\"dropdown\">\n\
  37. <div class=\"select\">\n\
  38. <span></span>\n\
  39. <i class=\"fa fa-chevron-down\"></i>\n\
  40. </div>\n\
  41. <input type=\"hidden\" name=\"version\">\n\
  42. <ul class=\"dropdown-menu\">\n\
  43. <!-- Versions will be added dynamically in version-picker.js -->\n\
  44. </ul>\n\
  45. </div>\n\
  46. </div>\
  47. ";
  48. next
  49. } 1' ./docs/website_files/theme/index.hbs > output.html && mv output.html ./docs/website_files/theme/index.hbs
  50. git add ./book.toml ./docs/website_files/version-picker.js ./docs/website_files/version-picker.css ./docs/website_files/version.js ./docs/website_files/README.md ./docs/website_files/theme/index.hbs
  51. git commit -m "Version picker added for $version docs"
  52. git push
  53. done
  54. - name: Build docs for Github Pages
  55. run: |
  56. git fetch
  57. git branch gh-pages origin/gh-pages
  58. for version in "v1.98" "v1.97" "v1.96" "v1.95" "v1.94" "v1.93" "v1.92" "v1.91" "v1.90" "v1.89" "v1.88" "v1.87" "v1.86" "v1.85" "v1.84" "v1.83" "v1.82" "v1.81" "v1.80" "v1.79" "v1.78" "v1.77" "v1.76" "v1.75" "v1.74" "v1.73" "v1.72" "v1.71" "v1.70" "v1.69" "v1.68" "v1.67" "v1.66" "v1.65" "v1.64" "v1.63" "v1.62" "v1.61" "v1.60" "v1.59" "v1.58" "v1.57" "v1.56" "v1.55" "v1.54" "v1.53" "v1.52" "v1.51" "v1.50" "v1.49" "v1.48" "v1.47" "v1.46" "v1.45" "v1.44" "v1.43" "v1.42" "v1.41" "v1.40" "v1.39" "v1.38" "v1.37"
  59. do
  60. git checkout release-$version
  61. mdbook build && cp book/welcome_and_overview.html book/index.html
  62. mkdir ver-temp && cp -r book/* ver-temp/
  63. rm -r ./book
  64. git checkout gh-pages
  65. rm -r $version
  66. mv ver-temp $version
  67. git add ./$version
  68. git commit -m "Version picker deployed for $version docs to Github Pages"
  69. done
  70. - name: Push to gh-pages
  71. run: |
  72. git checkout gh-pages
  73. git status
  74. git push