Build Godot Addon #98
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Godot Addon | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: macOS | |
| runner: macos-latest | |
| platform: macos | |
| arch: universal | |
| - name: Linux | |
| runner: ubuntu-22.04 | |
| platform: linux | |
| arch: x86_64 | |
| - name: Windows | |
| runner: windows-latest | |
| platform: windows | |
| arch: x86_64 | |
| runs-on: ${{ matrix.runner }} | |
| name: Build ${{ matrix.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install scons | |
| run: pip install scons | |
| - name: Checkout godot-cpp | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: godotengine/godot-cpp | |
| ref: godot-4.4-stable | |
| path: godot-cpp | |
| submodules: true | |
| - name: Build debug | |
| working-directory: godot | |
| run: scons platform=${{ matrix.platform }} arch=${{ matrix.arch }} target=template_debug -j4 | |
| env: | |
| GODOT_CPP_PATH: ${{ github.workspace }}/godot-cpp | |
| AMY_SRC_PATH: ${{ github.workspace }}/src | |
| - name: Build release | |
| working-directory: godot | |
| run: scons platform=${{ matrix.platform }} arch=${{ matrix.arch }} target=template_release -j4 | |
| env: | |
| GODOT_CPP_PATH: ${{ github.workspace }}/godot-cpp | |
| AMY_SRC_PATH: ${{ github.workspace }}/src | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bin-${{ matrix.platform }} | |
| path: godot/bin/ | |
| package: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: Package Addon | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: collected-bins/ | |
| - name: Assemble addon zip | |
| run: | | |
| mkdir -p addons/amy/bin | |
| # Copy compiled binaries from all platforms | |
| cp -r collected-bins/bin-macos/* addons/amy/bin/ | |
| cp -r collected-bins/bin-linux/* addons/amy/bin/ | |
| cp -r collected-bins/bin-windows/* addons/amy/bin/ | |
| # Copy GDExtension config and scripts | |
| cp godot/amy.gdextension addons/amy/ | |
| cp godot/amy.gd addons/amy/ | |
| cp godot/install.gd addons/amy/ | |
| # Copy web export files | |
| mkdir -p addons/amy/web | |
| cp godot/web/godot_amy_bridge.js addons/amy/web/ | |
| cp godot/web/custom_shell.html addons/amy/web/ | |
| cp docs/amy.js addons/amy/web/ | |
| cp docs/amy.wasm addons/amy/web/ | |
| cp docs/enable-threads.js addons/amy/web/ | |
| cp docs/enable-threads.js addons/amy/web/enable-threads-root.js | |
| # Create the zip | |
| zip -r amy-godot-addon.zip addons/ | |
| - name: Upload addon zip | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: amy-godot-addon | |
| path: amy-godot-addon.zip | |
| release: | |
| needs: package | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| name: Create Release | |
| steps: | |
| - name: Download addon zip | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: amy-godot-addon | |
| - name: Attach addon to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: amy-godot-addon.zip |