action.yaml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. name: Generate Documentation
  2. description: Updates Sphinx-based documentation
  3. inputs:
  4. sourceDirectory:
  5. description: Path to repository checkout
  6. required: false
  7. default: ${{ github.workspace }}
  8. disableLinkExtensions:
  9. description: Disable Sphinx link extensions
  10. required: false
  11. default: 'false'
  12. runs:
  13. using: composite
  14. steps:
  15. - name: Update Version Number and Copyright ↗️
  16. id: setup
  17. shell: bash
  18. run: |
  19. : Update Version Number and Copyright ↗️
  20. if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
  21. : "${major:=}"
  22. : "${minor:=}"
  23. : "${patch:=}"
  24. # This expression will first try to match all the LIBOBS_API_[...]_VER
  25. # lines in 'obs-config.h', before removing the '#define ' prefix and
  26. # trimming away whitespace characters and linebreaks.
  27. # This will yield a single line with the each major, minor, and patch
  28. # version variable name followed by its value, so every even item
  29. # in this string will contain a version part.
  30. read -r _ major _ minor _ patch _ <<< \
  31. "$(grep -E -e "#define LIBOBS_API_(MAJOR|MINOR|PATCH)_VER *" libobs/obs-config.h \
  32. | sed 's/#define //g' \
  33. | tr -s ' ' \
  34. | tr '\n' ' ')"
  35. # This expression simply replaces the definition of the 'version' and
  36. # 'release' variables in the Python script with updated variants using
  37. # the version tokens set by the previous expression.
  38. # The copyright variable assignment is updated to use the current
  39. # local year as the second year value.
  40. sed -i -E \
  41. -e "s/version = '([0-9]+\.[0-9]+\.[0-9]+)'/version = '${major}.${minor}.${patch}'/g" \
  42. -e "s/release = '([0-9]+\.[0-9]+\.[0-9]+)'/release = '${major}.${minor}.${patch}'/g" \
  43. -e "s/copyright = '(2017-[0-9]+, Lain Bailey)'/copyright = '2017-$(date +"%Y"), Lain Bailey'/g" \
  44. ${{ inputs.sourceDirectory }}/docs/sphinx/conf.py
  45. if [[ '${{ inputs.disableLinkExtensions }}' == 'true' ]]; then
  46. sed -i -e "s/html_link_suffix = None/html_link_suffix = ''/g" \
  47. ${{ inputs.sourceDirectory }}/docs/sphinx/conf.py
  48. echo "artifactName=OBS Studio Docs (No Extensions)" >> $GITHUB_OUTPUT
  49. else
  50. echo "artifactName=OBS Studio Docs" >> $GITHUB_OUTPUT
  51. fi
  52. echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
  53. - name: Install Sphinx 📜
  54. uses: totaldebug/sphinx-publish-action@a44364271972de3b13c5b63801c2596dfde82413
  55. with:
  56. sphinx_src: ${{ inputs.sourceDirectory }}/docs/sphinx
  57. build_only: true
  58. target_branch: master
  59. target_path: '../home/_build'
  60. - uses: actions/upload-artifact@v4
  61. with:
  62. name: ${{ steps.setup.outputs.artifactName }} ${{ steps.setup.outputs.commitHash }}
  63. path: |
  64. ${{ runner.temp }}/_github_home/_build
  65. !${{ runner.temp }}/_github_home/_build/.doctrees