diff --git a/.github/workflows/generate-lua-library.yml b/.github/workflows/generate-lua-library.yml new file mode 100644 index 0000000000..49d636bfc1 --- /dev/null +++ b/.github/workflows/generate-lua-library.yml @@ -0,0 +1,62 @@ +name: Generate Lua library +on: + workflow_dispatch: + push: + branches: + - master + paths: + - 'rts/Lua/**' +jobs: + generate-library: + name: Regenerate library + runs-on: ubuntu-latest + steps: + - name: Configure git + run: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + + - name: Checkout Lua CPP files + uses: actions/checkout@v4 + with: + sparse-checkout: rts/Lua + path: recoil + + - name: Install extractor tool + run: | + npm install rhys-vdw/lua-doc-extractor + + - name: Regenerate docs + working-directory: ./recoil/rts/Lua/ + run: | + rm -rf library/generated + npx lua-doc-extractor *.cpp --dest library/generated + + - name: Commit and push Recoil repo + uses: stefanzweifel/git-auto-commit-action@v5 + with: + repository: ./recoil + commit_message: Update LuaLS library + + - name: Check out library repo + uses: actions/checkout@v4 + with: + repository: rhys-vdw/recoil-lua-library + token: ${{ secrets.RECOIL_LUA_LIBRARY_GITHUB_TOKEN }} + path: library + + - name: Copy changes into library repo + run: | + rm -rf library/library + cp -r recoil/rts/Lua/library library + + # Always try to update library repo (even if generation did not make changes). + # Hand-written files may have changed without generated output changing, + # and library may simply be out of date for whatever reason. + - name: Commit and push library repo + uses: stefanzweifel/git-auto-commit-action@v5 + with: + repository: ./library + commit_message: | + Update library + Generated from https://github.com/${{ github.repository }}/commit/${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/generate-lua-metafiles.yml b/.github/workflows/generate-lua-metafiles.yml deleted file mode 100644 index dc163443cd..0000000000 --- a/.github/workflows/generate-lua-metafiles.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Generate Lua metafiles -on: - workflow_dispatch: - push: - branches: - - master - paths: - - 'rts/Lua/**' -jobs: - install-extractor: - name: Generate Lua metafiles - runs-on: ubuntu-latest - steps: - - name: Checkout Lua CPP files - uses: actions/checkout@v4 - with: - sparse-checkout: rts/Lua - - - name: Install extractor tool - run: | - npm install rhys-vdw/lua-doc-extractor - - - name: Regenerate docs - working-directory: ./rts/Lua/ - run: | - rm -rf library/generated - npx lua-doc-extractor *.cpp --dest library/generated - - - name: Commit and push - working-directory: ./rts/Lua/library - run: | - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config user.name "github-actions[bot]" - git add . - git commit -m "Update library" && git push || true