Write down where VR got to, and say plainly that headsets are not the… #21
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 | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| # must match an actual godot-builds release tag, and the engine the | |
| # project is developed against | |
| GODOT_VERSION: "4.7.2-stable" | |
| # OpenXR loaders for Quest and Pico, fetched by the android job | |
| OPENXR_VENDORS: 5.1.0-stable | |
| jobs: | |
| # Cheap guard: release signing credentials must never reach the repository. | |
| secrets-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: No keystore credentials in export_presets.cfg | |
| run: | | |
| if grep -Eq '^keystore/release(_user|_password)?="..*"' export_presets.cfg; then | |
| echo "::error file=export_presets.cfg::Keystore path or password committed. \ | |
| Clear the keystore/release* fields and use GODOT_ANDROID_KEYSTORE_RELEASE_* instead." | |
| exit 1 | |
| fi | |
| - name: No keystore files committed | |
| run: | | |
| if git ls-files | grep -Eq '\.(keystore|jks)$'; then | |
| echo "::error::A keystore file is tracked by git. Remove it and rotate the key." | |
| exit 1 | |
| fi | |
| desktop: | |
| needs: secrets-check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - preset: "Linux" | |
| out: "build/linux/OpenRhythm.x86_64" | |
| artifact: "linux" | |
| - preset: "Windows Desktop" | |
| out: "build/windows/OpenRhythm.exe" | |
| artifact: "windows" | |
| - preset: "Web" | |
| out: "build/web/index.html" | |
| artifact: "web" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Godot and export templates | |
| run: | | |
| set -euo pipefail | |
| base="https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}" | |
| curl -fL -o godot.zip "${base}/Godot_v${GODOT_VERSION}_linux.x86_64.zip" | |
| curl -fL -o templates.tpz "${base}/Godot_v${GODOT_VERSION}_export_templates.tpz" | |
| unzip -q godot.zip | |
| sudo mv "Godot_v${GODOT_VERSION}_linux.x86_64" /usr/local/bin/godot | |
| sudo chmod +x /usr/local/bin/godot | |
| unzip -q templates.tpz | |
| dest="$HOME/.local/share/godot/export_templates/${GODOT_VERSION/-/.}" | |
| mkdir -p "$(dirname "$dest")" | |
| mv templates "$dest" | |
| - name: Import resources | |
| run: godot --headless --path . --import || true | |
| - name: Core tests | |
| if: matrix.preset == 'Linux' | |
| run: godot --headless --path . res://tools/CoreTest.tscn | |
| - name: Layout tests | |
| if: matrix.preset == 'Linux' | |
| run: godot --headless --path . res://tools/LayoutTest.tscn | |
| - name: Export ${{ matrix.preset }} | |
| run: | | |
| mkdir -p "$(dirname '${{ matrix.out }}')" | |
| godot --headless --path . --export-release "${{ matrix.preset }}" "${{ matrix.out }}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: build/${{ matrix.artifact }}/ | |
| # Android is only built when the signing key is available as secrets. An | |
| # unsigned build would be useless: it could not install over an existing copy. | |
| android: | |
| needs: secrets-check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: check | |
| name: Is a signing key configured? | |
| run: | | |
| if [ -n "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" ]; then | |
| echo "have_key=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "have_key=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice::No ANDROID_KEYSTORE_BASE64 secret; skipping the Android build." | |
| fi | |
| - if: steps.check.outputs.have_key == 'true' | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - if: steps.check.outputs.have_key == 'true' | |
| uses: android-actions/setup-android@v3 | |
| - if: steps.check.outputs.have_key == 'true' | |
| name: Install Godot and export templates | |
| run: | | |
| set -euo pipefail | |
| base="https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}" | |
| curl -fL -o godot.zip "${base}/Godot_v${GODOT_VERSION}_linux.x86_64.zip" | |
| curl -fL -o templates.tpz "${base}/Godot_v${GODOT_VERSION}_export_templates.tpz" | |
| unzip -q godot.zip | |
| sudo mv "Godot_v${GODOT_VERSION}_linux.x86_64" /usr/local/bin/godot | |
| sudo chmod +x /usr/local/bin/godot | |
| unzip -q templates.tpz | |
| dest="$HOME/.local/share/godot/export_templates/${GODOT_VERSION/-/.}" | |
| mkdir -p "$(dirname "$dest")" | |
| mv templates "$dest" | |
| sdkmanager "build-tools;34.0.0" "platforms;android-34" >/dev/null | |
| - if: steps.check.outputs.have_key == 'true' | |
| name: Point Godot at the Android SDK | |
| run: | | |
| mkdir -p "$HOME/.config/godot" | |
| ver="${GODOT_VERSION%%-*}"; ver="${ver%.*}" | |
| cat > "$HOME/.config/godot/editor_settings-${ver}.tres" <<EOF | |
| [gd_resource type="EditorSettings" format=3] | |
| [resource] | |
| export/android/android_sdk_path = "${ANDROID_SDK_ROOT}" | |
| export/android/java_sdk_path = "${JAVA_HOME}" | |
| EOF | |
| - if: steps.check.outputs.have_key == 'true' | |
| name: Export Android | |
| env: | |
| GODOT_ANDROID_KEYSTORE_RELEASE_USER: ${{ secrets.ANDROID_KEYSTORE_USER }} | |
| GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| run: | | |
| set -euo pipefail | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > "$RUNNER_TEMP/release.keystore" | |
| export GODOT_ANDROID_KEYSTORE_RELEASE_PATH="$RUNNER_TEMP/release.keystore" | |
| godot --headless --path . --import || true | |
| mkdir -p build/android | |
| godot --headless --path . --export-release "Android" build/android/OpenRhythm.apk | |
| rm -f "$GODOT_ANDROID_KEYSTORE_RELEASE_PATH" | |
| # The headset builds need the OpenXR loaders, which are not in this repo: | |
| # they are 80 MB of vendor binaries with their own licences, so CI fetches | |
| # them at the version pinned here. | |
| - if: steps.check.outputs.have_key == 'true' | |
| name: Fetch the OpenXR vendor plugin | |
| run: | | |
| set -euo pipefail | |
| curl -sL -o vendors.zip \ | |
| https://github.com/GodotVR/godot_openxr_vendors/releases/download/${OPENXR_VENDORS}/godotopenxrvendorsaddon.zip | |
| unzip -q vendors.zip -d vendors | |
| mkdir -p addons | |
| cp -r vendors/asset/addons/godotopenxrvendors addons/ | |
| rm -rf vendors vendors.zip | |
| - if: steps.check.outputs.have_key == 'true' | |
| name: Export Quest and Pico | |
| env: | |
| GODOT_ANDROID_KEYSTORE_RELEASE_USER: ${{ secrets.ANDROID_KEYSTORE_USER }} | |
| GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| run: | | |
| set -euo pipefail | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > "$RUNNER_TEMP/release.keystore" | |
| export GODOT_ANDROID_KEYSTORE_RELEASE_PATH="$RUNNER_TEMP/release.keystore" | |
| godot --headless --path . --import || true | |
| # a headset package is a gradle build, which needs the template in place | |
| godot --headless --path . --install-android-build-template \ | |
| --export-release "Android" build/android/OpenRhythm.apk || true | |
| # the headset packages need the Mobile renderer, which the script | |
| # switches on for the length of those two builds | |
| tools/build_headsets.sh godot | |
| mv build/OpenRhythm-quest.apk build/android/OpenRhythm-quest.apk | |
| mv build/OpenRhythm-pico.apk build/android/OpenRhythm-pico.apk | |
| rm -f "$GODOT_ANDROID_KEYSTORE_RELEASE_PATH" | |
| - if: steps.check.outputs.have_key == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android | |
| path: build/android/ | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [desktop, android] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Package one file per platform | |
| run: | | |
| set -euo pipefail | |
| tag="${GITHUB_REF_NAME}" | |
| mkdir -p out | |
| for p in linux windows web; do | |
| [ -d "dist/$p" ] || continue | |
| (cd "dist/$p" && zip -qr "../../out/OpenRhythm-${tag}-${p}.zip" .) | |
| done | |
| if [ -f dist/android/OpenRhythm.apk ]; then | |
| cp dist/android/OpenRhythm.apk "out/OpenRhythm-${tag}-android.apk" | |
| fi | |
| # the headset packages, named for the store each one is sideloaded to | |
| for h in quest pico; do | |
| [ -f "dist/android/OpenRhythm-${h}.apk" ] || continue | |
| cp "dist/android/OpenRhythm-${h}.apk" "out/OpenRhythm-${tag}-${h}.apk" | |
| done | |
| ls -la out | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: out/* | |
| generate_release_notes: true |