scripting.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # SuperTux
  2. # Copyright (C) 2023 Vankata453
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 3
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. name: Scripting
  18. on:
  19. push:
  20. branches: [ "master" ]
  21. paths:
  22. - src/*
  23. - tools/scripting_docs_gen/*
  24. workflow_dispatch:
  25. jobs:
  26. scripting-update:
  27. runs-on: ubuntu-latest
  28. steps:
  29. - name: Checkout the repository
  30. uses: actions/checkout@v4
  31. with:
  32. fetch-depth: 1
  33. - name: Checkout the wiki repository
  34. uses: actions/checkout@v4
  35. with:
  36. repository: SuperTux/wiki
  37. path: wiki
  38. fetch-depth: 1
  39. - name: Install packages
  40. run: |
  41. sudo apt-get update
  42. sudo apt-get install -y \
  43. cmake \
  44. build-essential \
  45. g++-9 \
  46. libc++-dev \
  47. libtinyxml2-dev \
  48. doxygen
  49. - name: Build scripting reference generator
  50. working-directory: tools/scripting_docs_gen
  51. run: |
  52. cmake --version
  53. mkdir build
  54. cd build
  55. cmake .. -DBUILD_DOCUMENTATION_WITH_SCRIPTING=ON
  56. make
  57. - name: Generate scripting reference
  58. working-directory: tools/scripting_docs_gen/build
  59. run: |
  60. doxygen docs/Doxyfile
  61. rm ../../../wiki/Scripting*.md
  62. ./ScriptingDocsGen --dir docs/doxygen/xml \
  63. --home ../../../wiki/templates/ScriptingHome.md \
  64. --page ../../../wiki/templates/ScriptingPage.md \
  65. --output ../../../wiki
  66. - name: Check for changes
  67. working-directory: wiki
  68. run: |
  69. REF_UPDATED=true
  70. if git diff --exit-code; then
  71. REF_UPDATED=false
  72. fi
  73. echo "REFERENCE_UPDATED=$(echo $REF_UPDATED)" >> $GITHUB_ENV
  74. - name: Install SSH key
  75. if: ${{ env.REFERENCE_UPDATED == 'true' }}
  76. uses: shimataro/ssh-key-action@v2
  77. with:
  78. key: ${{ secrets.wiki_repo_key }}
  79. known_hosts: ${{ secrets.wiki_repo_hosts }}
  80. - name: Push changes to wiki
  81. if: ${{ env.REFERENCE_UPDATED == 'true' }}
  82. working-directory: wiki
  83. run: |
  84. git --version
  85. git status
  86. git config --global user.email "SuperTux-bot@users.noreply.github.com"
  87. git config --global user.name "SuperTux Bot"
  88. git add .
  89. git commit -m "Update scripting reference (SuperTux/supertux@${{ github.sha }})"
  90. git push git@github.com:SuperTux/wiki.git HEAD:master