Branch Scripts and Artifacts #216
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: Branch Scripts and Artifacts | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| platform: | |
| description: "Target platform for Rive build" | |
| required: true | |
| type: choice | |
| options: ["x86_64-linux", "arm64-linux", "arm64-macos", "x86_64-macos", "arm64-ios", "x86_64-ios", "arm64-android", "armv7-android", "js-web", "wasm-web", "wasm_pthread-web", "x86-win32", "x86_64-win32", "all"] | |
| default: "x86_64-linux" | |
| rive_repo_url: | |
| description: "Rive runtime repo URL (HTTPS)" | |
| required: true | |
| default: "https://github.com/rive-app/rive-runtime.git" | |
| rive_ref: | |
| description: "Rive runtime ref (branch/tag/commit). Leave empty for default." | |
| required: false | |
| default: "" | |
| rive_sha: | |
| description: "Rive runtime commit SHA to checkout (overrides rive_ref)" | |
| required: false | |
| default: "3a5b5058aca009b823154ed7f92c11d599c00ae3" | |
| upload_artifact: | |
| description: "Upload tarball artifact (defold-rive/lib + include)" | |
| required: true | |
| type: choice | |
| options: ["true", "false"] | |
| default: "false" | |
| commit_message: | |
| description: "Optional commit message suffix" | |
| required: false | |
| default: "" | |
| push_changes: | |
| description: "Push changes back to the same branch" | |
| required: true | |
| type: choice | |
| options: ["true", "false"] | |
| default: "true" | |
| defold_version: | |
| description: "Defold SDK version (defaults to latest stable)" | |
| required: false | |
| default: "latest" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: branch-artifacts-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| prepare-defoldsdk: | |
| name: defoldsdk | |
| uses: defold/github-actions-common/.github/workflows/defoldsdk.yml@master | |
| with: | |
| runner: ${{ github.event.inputs.platform == 'arm64-linux' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }} | |
| defold_channel: alpha | |
| defold_version: ${{ github.event.inputs.defold_version || 'latest' }} | |
| sdk_output_path: build/defoldsdk | |
| bob_output_path: bob.jar | |
| build-linux: | |
| if: ${{ github.event.inputs.platform == 'x86_64-linux' || github.event.inputs.platform == 'arm64-linux' || github.event.inputs.platform == 'all' }} | |
| runs-on: ${{ matrix.platform == 'arm64-linux' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }} | |
| strategy: | |
| matrix: | |
| platform: ${{ fromJSON(github.event.inputs.platform == 'all' && '["x86_64-linux","arm64-linux"]' || format('["{0}"]', github.event.inputs.platform)) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Resolve spirv-tools commit | |
| id: spirv-tools-ref | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| sha="$(git ls-remote https://github.com/KhronosGroup/SPIRV-Tools.git HEAD | awk '{print $1}')" | |
| if [ -z "${sha}" ]; then | |
| echo "error: failed to resolve SPIRV-Tools HEAD" >&2 | |
| exit 1 | |
| fi | |
| echo "sha=${sha}" >> "$GITHUB_OUTPUT" | |
| - name: Restore cached spirv-opt | |
| uses: actions/cache@v4 | |
| with: | |
| path: build/toolcache/spirv-opt/${{ runner.os }}-${{ runner.arch }} | |
| key: spirv-opt-${{ runner.os }}-${{ runner.arch }}-${{ steps.spirv-tools-ref.outputs.sha }} | |
| - name: Add cached spirv-opt to PATH | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cache_dir="${GITHUB_WORKSPACE}/build/toolcache/spirv-opt/${{ runner.os }}-${{ runner.arch }}" | |
| if [ -x "${cache_dir}/spirv-opt" ]; then | |
| echo "${cache_dir}" >> "$GITHUB_PATH" | |
| fi | |
| - name: Install Linux build dependencies (uuid, X11, Xcursor, Xrandr, Xi, Xinerama, Xf86VidMode, glslang, spirv-tools) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y uuid-dev libx11-dev libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libxxf86vm-dev glslang-tools spirv-tools | |
| - name: Ensure spirv-opt supports --preserve-interface | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cache_dir="${GITHUB_WORKSPACE}/build/toolcache/spirv-opt/${{ runner.os }}-${{ runner.arch }}" | |
| mkdir -p "${cache_dir}" | |
| if spirv-opt --help 2>&1 | grep -q -- '--preserve-interface'; then | |
| spirv-opt --version || true | |
| exit 0 | |
| fi | |
| sudo apt-get install -y cmake ninja-build | |
| TMP_DIR="$(mktemp -d)" | |
| git clone --depth 1 https://github.com/KhronosGroup/SPIRV-Tools.git "${TMP_DIR}/SPIRV-Tools" | |
| git -C "${TMP_DIR}/SPIRV-Tools" fetch --depth 1 origin "${{ steps.spirv-tools-ref.outputs.sha }}" | |
| git -C "${TMP_DIR}/SPIRV-Tools" checkout --detach "${{ steps.spirv-tools-ref.outputs.sha }}" | |
| python3 "${TMP_DIR}/SPIRV-Tools/utils/git-sync-deps" | |
| cmake -S "${TMP_DIR}/SPIRV-Tools" -B "${TMP_DIR}/build" -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DSPIRV_SKIP_TESTS=ON | |
| cmake --build "${TMP_DIR}/build" --target spirv-opt | |
| SPIRV_OPT_BIN="$(find "${TMP_DIR}/build" -type f -name spirv-opt | head -n 1)" | |
| if [ -z "${SPIRV_OPT_BIN}" ]; then | |
| echo "error: failed to build spirv-opt" >&2 | |
| exit 1 | |
| fi | |
| install -m 0755 "${SPIRV_OPT_BIN}" "${cache_dir}/spirv-opt" | |
| echo "${cache_dir}" >> "$GITHUB_PATH" | |
| export PATH="${cache_dir}:${PATH}" | |
| spirv-opt --version | |
| spirv-opt --help | grep -- '--preserve-interface' | |
| - name: Setup LLVM/Clang 17 | |
| uses: KyleMayes/install-llvm-action@v2 | |
| with: | |
| version: 17.0.6 | |
| directory: ${{ runner.temp }}/llvm | |
| - name: Verify Clang version | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| which clang || true | |
| which clang++ || true | |
| clang --version | |
| clang++ --version | |
| - name: Build, (optionally) upload, and commit | |
| uses: ./.github/actions/rive-build | |
| with: | |
| platform: ${{ matrix.platform }} | |
| rive_repo_url: ${{ github.event.inputs.rive_repo_url }} | |
| rive_ref: ${{ github.event.inputs.rive_ref }} | |
| rive_sha: ${{ github.event.inputs.rive_sha }} | |
| upload_artifact: ${{ github.event.inputs.upload_artifact }} | |
| commit_message: ${{ github.event.inputs.commit_message }} | |
| push_changes: ${{ github.event.inputs.push_changes }} | |
| with_vulkan: true | |
| build-macos: | |
| if: ${{ github.event.inputs.platform == 'arm64-macos' || github.event.inputs.platform == 'x86_64-macos' || github.event.inputs.platform == 'arm64-ios' || github.event.inputs.platform == 'x86_64-ios' || github.event.inputs.platform == 'all' }} | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| platform: ${{ fromJSON(github.event.inputs.platform == 'all' && '["arm64-macos","x86_64-macos","arm64-ios","x86_64-ios"]' || format('["{0}"]', github.event.inputs.platform)) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Select Xcode 16.2 | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '16.2' | |
| - name: Build, (optionally) upload, and commit | |
| uses: ./.github/actions/rive-build | |
| with: | |
| platform: ${{ matrix.platform }} | |
| rive_repo_url: ${{ github.event.inputs.rive_repo_url }} | |
| rive_ref: ${{ github.event.inputs.rive_ref }} | |
| rive_sha: ${{ github.event.inputs.rive_sha }} | |
| upload_artifact: ${{ github.event.inputs.upload_artifact }} | |
| commit_message: ${{ github.event.inputs.commit_message }} | |
| push_changes: ${{ github.event.inputs.push_changes }} | |
| build-android: | |
| if: ${{ github.event.inputs.platform == 'arm64-android' || github.event.inputs.platform == 'armv7-android' || github.event.inputs.platform == 'all' }} | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| platform: ${{ fromJSON(github.event.inputs.platform == 'all' && '["arm64-android","armv7-android"]' || format('["{0}"]', github.event.inputs.platform)) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Set up Android NDK r25c (25.2.9519653) | |
| id: setup-ndk | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: r25c | |
| - name: Export ANDROID_NDK env | |
| shell: bash | |
| run: | | |
| echo "ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV" | |
| echo "Using ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }}" | |
| - name: Configure Android toolchain environment | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "ANDROID_NDK_HOME=${ANDROID_NDK}" >> "$GITHUB_ENV" | |
| echo "NDK_PATH=${ANDROID_NDK}" >> "$GITHUB_ENV" | |
| # API 21 is a safe default for arm64 and armv7 toolchains | |
| echo "ANDROID_API=21" >> "$GITHUB_ENV" | |
| - name: Build, (optionally) upload, and commit | |
| uses: ./.github/actions/rive-build | |
| with: | |
| platform: ${{ matrix.platform }} | |
| rive_repo_url: ${{ github.event.inputs.rive_repo_url }} | |
| rive_ref: ${{ github.event.inputs.rive_ref }} | |
| rive_sha: ${{ github.event.inputs.rive_sha }} | |
| upload_artifact: ${{ github.event.inputs.upload_artifact }} | |
| commit_message: ${{ github.event.inputs.commit_message }} | |
| push_changes: ${{ github.event.inputs.push_changes }} | |
| build-web: | |
| if: ${{ github.event.inputs.platform == 'js-web' || github.event.inputs.platform == 'wasm-web' || github.event.inputs.platform == 'wasm_pthread-web' || github.event.inputs.platform == 'all' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| platform: ${{ fromJSON(github.event.inputs.platform == 'all' && '["js-web","wasm-web","wasm_pthread-web"]' || format('["{0}"]', github.event.inputs.platform)) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install Linux dependencies (uuid, glslangValidator, spirv-tools) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y uuid-dev glslang-tools | |
| sudo apt-get install -y spirv-tools | |
| - name: Verify spirv-tools | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| spirv-opt --version | |
| - name: Build, (optionally) upload, and commit | |
| uses: ./.github/actions/rive-build | |
| with: | |
| platform: ${{ matrix.platform }} | |
| rive_repo_url: ${{ github.event.inputs.rive_repo_url }} | |
| rive_ref: ${{ github.event.inputs.rive_ref }} | |
| rive_sha: ${{ github.event.inputs.rive_sha }} | |
| upload_artifact: ${{ github.event.inputs.upload_artifact }} | |
| commit_message: ${{ github.event.inputs.commit_message }} | |
| push_changes: ${{ github.event.inputs.push_changes }} | |
| # build-windows: | |
| # if: ${{ github.event.inputs.platform == 'x86-win32' || github.event.inputs.platform == 'x86_64-win32' || github.event.inputs.platform == 'all' }} | |
| # runs-on: windows-2022 | |
| # strategy: | |
| # matrix: | |
| # platform: ${{ fromJSON(github.event.inputs.platform == 'all' && '["x86_64-win32"]' || format('["{0}"]', github.event.inputs.platform)) }} | |
| # steps: | |
| # - name: Checkout repository | |
| # uses: actions/checkout@v5 | |
| # with: | |
| # fetch-depth: 1 | |
| # - name: Setup VS DevCmd (x64) | |
| # if: ${{ matrix.platform == 'x86_64-win32' }} | |
| # uses: ilammy/msvc-dev-cmd@v1 | |
| # with: | |
| # arch: x64 | |
| # vsversion: 2022 | |
| # toolset: 14.20 | |
| # sdk: 10.0.22621.0 | |
| # - name: Setup VS DevCmd (x86) | |
| # if: ${{ matrix.platform == 'x86-win32' }} | |
| # uses: ilammy/msvc-dev-cmd@v1 | |
| # with: | |
| # arch: x86 | |
| # vsversion: 2022 | |
| # toolset: 14.20 | |
| # sdk: 10.0.22621.0 | |
| # - name: MSBuild sanity check | |
| # shell: pwsh | |
| # run: | | |
| # msbuild -version | |
| # Get-Command msbuild.exe | Format-List -Property Source | |
| # - name: Install DirectX Shader Compiler (DXC) | |
| # shell: bash | |
| # run: | | |
| # set -euo pipefail | |
| # choco install directxshadercompiler -y || true | |
| # # Verify availability if installed | |
| # dxc.exe -version 2> NUL || true | |
| # - name: Build, (optionally) upload, and commit | |
| # uses: ./.github/actions/rive-build | |
| # with: | |
| # platform: ${{ matrix.platform }} | |
| # rive_repo_url: ${{ github.event.inputs.rive_repo_url }} | |
| # rive_ref: ${{ github.event.inputs.rive_ref }} | |
| # rive_sha: ${{ github.event.inputs.rive_sha }} | |
| # upload_artifact: ${{ github.event.inputs.upload_artifact }} | |
| # commit_message: ${{ github.event.inputs.commit_message }} | |
| # push_changes: ${{ github.event.inputs.push_changes }} | |
| build-windows: | |
| if: ${{ github.event.inputs.platform == 'x86-win32' || github.event.inputs.platform == 'x86_64-win32' || github.event.inputs.platform == 'all' }} | |
| runs-on: windows-2022 | |
| strategy: | |
| matrix: | |
| platform: ${{ fromJSON(github.event.inputs.platform == 'all' && '["x86_64-win32"]' || format('["{0}"]', github.event.inputs.platform)) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Python 3 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Clone Rive runtime | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| RIVE_TMP_DIR=$(mktemp -d) | |
| git clone --depth 1 "${{ github.event.inputs.rive_repo_url }}" "$RIVE_TMP_DIR" | |
| if [ -n "${{ github.event.inputs.rive_sha }}" ]; then | |
| (cd "$RIVE_TMP_DIR" && git fetch --depth 1 origin "${{ github.event.inputs.rive_sha }}" && git checkout --force "${{ github.event.inputs.rive_sha }}") | |
| elif [ -n "${{ github.event.inputs.rive_ref }}" ]; then | |
| (cd "$RIVE_TMP_DIR" && git fetch --depth 1 origin "${{ github.event.inputs.rive_ref }}" && git checkout --force "${{ github.event.inputs.rive_ref }}") | |
| fi | |
| echo "RIVE_TMP_DIR=$RIVE_TMP_DIR" >> "$GITHUB_ENV" | |
| - name: Setup VS DevCmd (x64) | |
| if: ${{ matrix.platform == 'x86_64-win32' }} | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| vsversion: 2022 | |
| toolset: 14.20 | |
| sdk: 10.0.22621.0 | |
| - name: Setup VS DevCmd (x86) | |
| if: ${{ matrix.platform == 'x86-win32' }} | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x86 | |
| vsversion: 2022 | |
| toolset: 14.20 | |
| sdk: 10.0.22621.0 | |
| - name: Setup CMake 4.1 | |
| uses: lukka/get-cmake@v4.1.1 | |
| - name: MSBuild sanity check | |
| shell: pwsh | |
| run: | | |
| msbuild -version | |
| Get-Command msbuild.exe | Format-List -Property Source | |
| - name: Install DirectX Shader Compiler (DXC) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| choco install directxshadercompiler -y || true | |
| dxc.exe -version 2> /dev/null || true | |
| - name: Build libraries with Vulkan | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ./utils/build_rive_runtime.sh "${{ matrix.platform }}" "$RIVE_TMP_DIR" --with-vulkan | |
| - name: Commit native libs | |
| if: ${{ github.event.inputs.push_changes == 'true' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| PLATFORM_DIR="defold-rive/lib/${{ matrix.platform }}" | |
| git add -v "$PLATFORM_DIR" || true | |
| if git diff --cached --quiet; then | |
| echo "No native lib changes to commit." | |
| exit 0 | |
| fi | |
| msg="ci: update native libs (${{ matrix.platform }}) on ${{ github.ref_name }} [skip ci]" | |
| if [ -n "${{ github.event.inputs.commit_message }}" ]; then | |
| msg="$msg - ${{ github.event.inputs.commit_message }}" | |
| fi | |
| git commit -m "$msg" | |
| max_attempts=3 | |
| attempt=1 | |
| until [ $attempt -gt $max_attempts ]; do | |
| echo "Attempt $attempt: rebase + push" | |
| if git pull --rebase origin "${{ github.ref_name }}"; then | |
| if git push origin HEAD:"${{ github.ref_name }}"; then | |
| echo "Push succeeded" | |
| break | |
| fi | |
| else | |
| echo "Rebase failed; aborting and retrying" | |
| git rebase --abort || true | |
| fi | |
| attempt=$((attempt+1)) | |
| sleep $((attempt*2)) | |
| done | |
| if [ $attempt -gt $max_attempts ]; then | |
| echo "Push failed after $max_attempts attempts" | |
| exit 1 | |
| fi | |
| build-plugin-macos: | |
| if: ${{ github.event.inputs.platform == 'arm64-macos' || github.event.inputs.platform == 'x86_64-macos' || github.event.inputs.platform == 'all' }} | |
| needs: [build-macos, prepare-defoldsdk] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Temurin Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| - name: Verify Java | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| java --version | |
| - name: Setup CMake 4.1 | |
| uses: lukka/get-cmake@v4.1.1 | |
| - name: Verify CMake | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cmake --version | |
| - name: Restore Defold SDK and bob.jar from cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| bob.jar | |
| build/defoldsdk | |
| key: ${{ needs.prepare-defoldsdk.outputs.defoldsdk_cache_key }} | |
| enableCrossOsArchive: true | |
| fail-on-cache-miss: true | |
| - name: Download Defold protoc | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| PROTOBUF_VERSION="3.20.1" | |
| case "$(uname -m)" in | |
| arm64) PROTOBUF_PLATFORM="arm64-macos" ;; | |
| x86_64) PROTOBUF_PLATFORM="x86_64-macos" ;; | |
| *) echo "Unsupported macOS architecture: $(uname -m)" >&2; exit 1 ;; | |
| esac | |
| PROTOBUF_ARCHIVE="protobuf-${PROTOBUF_VERSION}-${PROTOBUF_PLATFORM}.tar.gz" | |
| PROTOBUF_URL="https://github.com/defold/defold/raw/dev/packages/${PROTOBUF_ARCHIVE}" | |
| PROTOBUF_DIR="${RUNNER_TEMP}/defold-protobuf/${PROTOBUF_PLATFORM}" | |
| mkdir -p "${PROTOBUF_DIR}" | |
| curl -L --fail -o "${RUNNER_TEMP}/${PROTOBUF_ARCHIVE}" "${PROTOBUF_URL}" | |
| tar -xzf "${RUNNER_TEMP}/${PROTOBUF_ARCHIVE}" -C "${PROTOBUF_DIR}" | |
| PROTOC_BIN="${PROTOBUF_DIR}/bin/protoc" | |
| if [ ! -x "${PROTOC_BIN}" ]; then | |
| PROTOC_BIN="$(find "${PROTOBUF_DIR}" -type f -name protoc | head -n 1)" | |
| fi | |
| if [ -z "${PROTOC_BIN}" ] || [ ! -x "${PROTOC_BIN}" ]; then | |
| echo "Could not find executable protoc in ${PROTOBUF_DIR}" >&2 | |
| find "${PROTOBUF_DIR}" -maxdepth 4 -type f | sed -n '1,200p' | |
| exit 1 | |
| fi | |
| echo "PROTOC=${PROTOC_BIN}" >> "$GITHUB_ENV" | |
| "${PROTOC_BIN}" --version | |
| - name: Build editor plugins | |
| shell: bash | |
| env: | |
| DYNAMO_HOME: ${{ github.workspace }}/build/defoldsdk/defoldsdk | |
| BOB: ${{ github.workspace }}/bob.jar | |
| PROTOC: ${{ env.PROTOC }} | |
| run: | | |
| set -euo pipefail | |
| ./utils/build_plugin.sh arm64-macos | |
| ./utils/build_plugin.sh x86_64-macos | |
| - name: Commit plugin outputs | |
| if: ${{ github.event.inputs.push_changes == 'true' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| CONFLICT_FILE="defold-rive/plugins/share/pluginRiveExt.jar" | |
| if git ls-files -u "$CONFLICT_FILE" >/dev/null 2>&1; then | |
| git checkout --ours "$CONFLICT_FILE" | |
| fi | |
| git add -v defold-rive/plugins || true | |
| if git diff --cached --quiet; then | |
| echo "No plugin changes to commit." | |
| exit 0 | |
| fi | |
| msg="ci: update editor plugin on ${{ github.ref_name }} [skip ci]" | |
| if [ -n "${{ github.event.inputs.commit_message }}" ]; then | |
| msg="$msg - ${{ github.event.inputs.commit_message }}" | |
| fi | |
| git commit -m "$msg" | |
| max_attempts=3 | |
| attempt=1 | |
| until [ $attempt -gt $max_attempts ]; do | |
| echo "Attempt $attempt: rebase + push" | |
| if git pull --rebase origin "${{ github.ref_name }}"; then | |
| if git push origin HEAD:"${{ github.ref_name }}"; then | |
| echo "Push succeeded" | |
| break | |
| fi | |
| else | |
| echo "Rebase failed; aborting and retrying" | |
| git rebase --abort || true | |
| fi | |
| attempt=$((attempt+1)) | |
| sleep $((attempt*2)) | |
| done | |
| if [ $attempt -gt $max_attempts ]; then | |
| echo "Push failed after $max_attempts attempts" | |
| exit 1 | |
| fi | |
| build-plugin-linux: | |
| if: ${{ github.event.inputs.platform == 'x86_64-linux' || github.event.inputs.platform == 'all' }} | |
| needs: [build-linux, prepare-defoldsdk] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Temurin Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| - name: Verify Java | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| java --version | |
| - name: Setup CMake 4.1 | |
| uses: lukka/get-cmake@v4.1.1 | |
| - name: Verify CMake | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cmake --version | |
| - name: Setup LLVM/Clang 17 | |
| uses: KyleMayes/install-llvm-action@v2 | |
| with: | |
| version: 17.0.6 | |
| directory: ${{ runner.temp }}/llvm | |
| - name: Verify Clang version | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| which clang || true | |
| which clang++ || true | |
| clang --version | |
| clang++ --version | |
| - name: Install Linux OpenGL dependencies | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y libgl1-mesa-dev libglx-dev | |
| - name: Restore Defold SDK and bob.jar from cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| bob.jar | |
| build/defoldsdk | |
| key: ${{ needs.prepare-defoldsdk.outputs.defoldsdk_cache_key }} | |
| enableCrossOsArchive: true | |
| fail-on-cache-miss: true | |
| - name: Download Defold protoc | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| PROTOBUF_VERSION="3.20.1" | |
| PROTOBUF_PLATFORM="x86_64-linux" | |
| PROTOBUF_ARCHIVE="protobuf-${PROTOBUF_VERSION}-${PROTOBUF_PLATFORM}.tar.gz" | |
| PROTOBUF_URL="https://github.com/defold/defold/raw/dev/packages/${PROTOBUF_ARCHIVE}" | |
| PROTOBUF_DIR="${RUNNER_TEMP}/defold-protobuf/${PROTOBUF_PLATFORM}" | |
| mkdir -p "${PROTOBUF_DIR}" | |
| curl -L --fail -o "${RUNNER_TEMP}/${PROTOBUF_ARCHIVE}" "${PROTOBUF_URL}" | |
| tar -xzf "${RUNNER_TEMP}/${PROTOBUF_ARCHIVE}" -C "${PROTOBUF_DIR}" | |
| PROTOC_BIN="${PROTOBUF_DIR}/bin/protoc" | |
| if [ ! -x "${PROTOC_BIN}" ]; then | |
| PROTOC_BIN="$(find "${PROTOBUF_DIR}" -type f -name protoc | head -n 1)" | |
| fi | |
| if [ -z "${PROTOC_BIN}" ] || [ ! -x "${PROTOC_BIN}" ]; then | |
| echo "Could not find executable protoc in ${PROTOBUF_DIR}" >&2 | |
| find "${PROTOBUF_DIR}" -maxdepth 4 -type f | sed -n '1,200p' | |
| exit 1 | |
| fi | |
| echo "PROTOC=${PROTOC_BIN}" >> "$GITHUB_ENV" | |
| "${PROTOC_BIN}" --version | |
| - name: Build linux plugin | |
| shell: bash | |
| env: | |
| DYNAMO_HOME: ${{ github.workspace }}/build/defoldsdk/defoldsdk | |
| BOB: ${{ github.workspace }}/bob.jar | |
| PROTOC: ${{ env.PROTOC }} | |
| run: | | |
| set -euo pipefail | |
| ./utils/build_plugin.sh x86_64-linux | |
| - name: Commit linux plugin outputs | |
| if: ${{ github.event.inputs.push_changes == 'true' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| CONFLICT_FILE="defold-rive/plugins/share/pluginRiveExt.jar" | |
| if git ls-files -u "$CONFLICT_FILE" >/dev/null 2>&1; then | |
| git checkout --ours "$CONFLICT_FILE" | |
| fi | |
| git add -v defold-rive/plugins || true | |
| if git diff --cached --quiet; then | |
| echo "No plugin changes to commit." | |
| exit 0 | |
| fi | |
| msg="ci: update linux plugin on ${{ github.ref_name }} [skip ci]" | |
| if [ -n "${{ github.event.inputs.commit_message }}" ]; then | |
| msg="$msg - ${{ github.event.inputs.commit_message }}" | |
| fi | |
| git commit -m "$msg" | |
| max_attempts=3 | |
| attempt=1 | |
| until [ $attempt -gt $max_attempts ]; do | |
| echo "Attempt $attempt: rebase + push" | |
| if git pull --rebase origin "${{ github.ref_name }}"; then | |
| if git push origin HEAD:"${{ github.ref_name }}"; then | |
| echo "Push succeeded" | |
| break | |
| fi | |
| else | |
| echo "Rebase failed; aborting and retrying" | |
| git rebase --abort || true | |
| fi | |
| attempt=$((attempt+1)) | |
| sleep $((attempt*2)) | |
| done | |
| if [ $attempt -gt $max_attempts ]; then | |
| echo "Push failed after $max_attempts attempts" | |
| exit 1 | |
| fi | |
| build-plugin-windows: | |
| if: ${{ github.event.inputs.platform == 'x86_64-win32' || github.event.inputs.platform == 'all' }} | |
| needs: [build-windows, prepare-defoldsdk] | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Temurin Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| - name: Verify Java | |
| shell: pwsh | |
| run: | | |
| java --version | |
| - name: Setup CMake 4.1 | |
| uses: lukka/get-cmake@v4.1.1 | |
| - name: Verify CMake | |
| shell: pwsh | |
| run: | | |
| cmake --version | |
| - name: Restore Defold SDK and bob.jar from cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| bob.jar | |
| build/defoldsdk | |
| key: ${{ needs.prepare-defoldsdk.outputs.defoldsdk_cache_key }} | |
| enableCrossOsArchive: true | |
| fail-on-cache-miss: true | |
| - name: Download Defold protoc | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| PROTOBUF_VERSION="3.20.1" | |
| PROTOBUF_PLATFORM="x86_64-win32" | |
| PROTOBUF_ARCHIVE="protobuf-${PROTOBUF_VERSION}-${PROTOBUF_PLATFORM}.tar.gz" | |
| PROTOBUF_URL="https://github.com/defold/defold/raw/dev/packages/${PROTOBUF_ARCHIVE}" | |
| TMP_ROOT="$(cygpath -u "${RUNNER_TEMP}" 2>/dev/null || echo "${RUNNER_TEMP}")" | |
| PROTOBUF_DIR="${TMP_ROOT}/defold-protobuf/${PROTOBUF_PLATFORM}" | |
| mkdir -p "${PROTOBUF_DIR}" | |
| ARCHIVE_PATH="${TMP_ROOT}/${PROTOBUF_ARCHIVE}" | |
| curl -L --fail -o "${ARCHIVE_PATH}" "${PROTOBUF_URL}" | |
| tar -xzf "${ARCHIVE_PATH}" -C "${PROTOBUF_DIR}" | |
| PROTOC_BIN="${PROTOBUF_DIR}/bin/protoc.exe" | |
| if [ ! -x "${PROTOC_BIN}" ]; then | |
| PROTOC_BIN="$(find "${PROTOBUF_DIR}" -type f -name protoc.exe | head -n 1)" | |
| fi | |
| if [ -z "${PROTOC_BIN}" ] || [ ! -x "${PROTOC_BIN}" ]; then | |
| echo "Could not find executable protoc.exe in ${PROTOBUF_DIR}" >&2 | |
| find "${PROTOBUF_DIR}" -maxdepth 4 -type f | sed -n '1,200p' | |
| exit 1 | |
| fi | |
| echo "PROTOC=${PROTOC_BIN}" >> "$GITHUB_ENV" | |
| "${PROTOC_BIN}" --version | |
| - name: Build windows plugin | |
| shell: bash | |
| env: | |
| DYNAMO_HOME: ${{ github.workspace }}/build/defoldsdk/defoldsdk | |
| BOB: ${{ github.workspace }}/bob.jar | |
| PROTOC: ${{ env.PROTOC }} | |
| run: | | |
| set -euo pipefail | |
| ./utils/build_plugin.sh x86_64-win32 | |
| - name: Commit windows plugin outputs | |
| if: ${{ github.event.inputs.push_changes == 'true' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| CONFLICT_FILE="defold-rive/plugins/share/pluginRiveExt.jar" | |
| if git ls-files -u "$CONFLICT_FILE" >/dev/null 2>&1; then | |
| git checkout --ours "$CONFLICT_FILE" | |
| fi | |
| git add -v defold-rive/plugins || true | |
| if git diff --cached --quiet; then | |
| echo "No plugin changes to commit." | |
| exit 0 | |
| fi | |
| msg="ci: update windows plugin on ${{ github.ref_name }} [skip ci]" | |
| if [ -n "${{ github.event.inputs.commit_message }}" ]; then | |
| msg="$msg - ${{ github.event.inputs.commit_message }}" | |
| fi | |
| git commit -m "$msg" | |
| max_attempts=3 | |
| attempt=1 | |
| until [ $attempt -gt $max_attempts ]; do | |
| echo "Attempt $attempt: rebase + push" | |
| if git pull --rebase origin "${{ github.ref_name }}"; then | |
| if git push origin HEAD:"${{ github.ref_name }}"; then | |
| echo "Push succeeded" | |
| break | |
| fi | |
| else | |
| echo "Rebase failed; aborting and retrying" | |
| git rebase --abort || true | |
| fi | |
| attempt=$((attempt+1)) | |
| sleep $((attempt*2)) | |
| done | |
| if [ $attempt -gt $max_attempts ]; then | |
| echo "Push failed after $max_attempts attempts" | |
| exit 1 | |
| fi |