|
| 1 | +name: Build Geode Mod (Codeberg) |
| 2 | + |
| 3 | +# Thank you very much to https://github.com/altalk23/Allium |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - "**" |
| 10 | + |
| 11 | +env: |
| 12 | + MOD_ID: firee.object-workshop |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + config: |
| 20 | + - name: Windows |
| 21 | + target: windows |
| 22 | + artifact-name: geode-build-win |
| 23 | + platform: windows |
| 24 | + |
| 25 | + - name: macOS |
| 26 | + target: macos |
| 27 | + artifact-name: geode-build-mac |
| 28 | + platform: macos |
| 29 | + |
| 30 | + - name: iOS |
| 31 | + target: ios |
| 32 | + artifact-name: geode-build-ios |
| 33 | + platform: ios |
| 34 | + |
| 35 | + - name: Android32 |
| 36 | + target: android |
| 37 | + artifact-name: geode-build-android32 |
| 38 | + platform: android32 |
| 39 | + |
| 40 | + - name: Android64 |
| 41 | + target: android |
| 42 | + artifact-name: geode-build-android64 |
| 43 | + platform: android64 |
| 44 | + |
| 45 | + name: ${{ matrix.config.name }} |
| 46 | + runs-on: codeberg-medium |
| 47 | + container: |
| 48 | + image: prevter/geode-sdk:${{ matrix.config.image }}-latest |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout repository |
| 52 | + uses: actions/checkout@v4 |
| 53 | + |
| 54 | + # rest is taken from Dockerfile |
| 55 | + |
| 56 | + - name: Install SDK & Binaries |
| 57 | + run: | |
| 58 | + geode sdk update stable |
| 59 | + geode sdk install-binaries -p ${{ matrix.config.platform }} |
| 60 | + git clone https://github.com/geode-sdk/bindings --depth=1 /workspace/bindings |
| 61 | +
|
| 62 | + - name: Configure & Build |
| 63 | + run: | |
| 64 | + GEODE_BINDINGS_REPO_PATH=/workspace/bindings geode build -p ${{ matrix.config.platform }} --config RelWithDebInfo |
| 65 | + mkdir -p /workspace/out |
| 66 | + cp build/${{ env.MOD_ID }}.geode /workspace/out/ |
| 67 | +
|
| 68 | + - name: Upload ${{ matrix.config.name }} artifact |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: ${{ matrix.config.artifact-name }} |
| 72 | + path: /workspace/out/ |
| 73 | + |
| 74 | + package: |
| 75 | + name: Package builds |
| 76 | + runs-on: codeberg-small |
| 77 | + needs: ['build'] |
| 78 | + |
| 79 | + steps: |
| 80 | + - uses: https://data.forgejo.org/forgejo/download-artifact@v4 |
| 81 | + with: |
| 82 | + merge-multiple: false |
| 83 | + path: ./artifacts |
| 84 | + |
| 85 | + # TODO: Fix this so it gets latest via https://api.github.com/repos/geode-sdk/cli/releases/latest |
| 86 | + - name: Download CLI |
| 87 | + run: | |
| 88 | + curl -L "https://github.com/geode-sdk/cli/releases/download/v3.7.4/geode-cli-v3.7.4-linux.zip" -o cli.zip |
| 89 | + unzip cli.zip -d . |
| 90 | + chmod +x ./geode |
| 91 | + |
| 92 | + - name: Merge Artifacts |
| 93 | + run: | |
| 94 | + mkdir -p out |
| 95 | + MODS=$(find ./artifacts -name *.geode -type f -printf "%f\n" | sort -u) |
| 96 | + for mod in $MODS; do |
| 97 | + echo "Merging $mod" |
| 98 | + PACKAGE_ARGS="" |
| 99 | + if [ -f "./artifacts/geode-build-win/$mod" ]; then |
| 100 | + PACKAGE_ARGS="$PACKAGE_ARGS ./artifacts/geode-build-win/$mod" |
| 101 | + fi |
| 102 | + if [ -f "./artifacts/geode-build-mac/$mod" ]; then |
| 103 | + PACKAGE_ARGS="$PACKAGE_ARGS ./artifacts/geode-build-mac/$mod" |
| 104 | + fi |
| 105 | + if [ -f "./artifacts/geode-build-android32/$mod" ]; then |
| 106 | + PACKAGE_ARGS="$PACKAGE_ARGS ./artifacts/geode-build-android32/$mod" |
| 107 | + fi |
| 108 | + if [ -f "./artifacts/geode-build-android64/$mod" ]; then |
| 109 | + PACKAGE_ARGS="$PACKAGE_ARGS ./artifacts/geode-build-android64/$mod" |
| 110 | + fi |
| 111 | + if [ -f "./artifacts/geode-build-ios/$mod" ]; then |
| 112 | + PACKAGE_ARGS="$PACKAGE_ARGS ./artifacts/geode-build-ios/$mod" |
| 113 | + fi |
| 114 | + ARG_LIST=($PACKAGE_ARGS) |
| 115 | + # why does it merge into the first one instead of just an output.. |
| 116 | + FIRST="${ARG_LIST[0]}" |
| 117 | + if [ ${#ARG_LIST[@]} != 1 ]; then |
| 118 | + ./geode package merge $PACKAGE_ARGS |
| 119 | + fi |
| 120 | + cp $FIRST out |
| 121 | + done |
| 122 | + # Copy the .pdb file from windows artifact if it exists |
| 123 | + cp ./artifacts/geode-build-win/*.pdb out/ || true |
| 124 | + # Copy the .sym files from android artifacts if they exist |
| 125 | + cp ./artifacts/geode-build-android32/*.sym out/ || true |
| 126 | + cp ./artifacts/geode-build-android64/*.sym out/ || true |
| 127 | + # Copy the other debug files from android and macos/ios |
| 128 | + cp ./artifacts/geode-build-android32/*.dbg out/ || true |
| 129 | + cp ./artifacts/geode-build-android64/*.dbg out/ || true |
| 130 | + cp -R ./artifacts/geode-build-mac/*.dSYM out/ || true |
| 131 | + cp -R ./artifacts/geode-build-ios/*.dSYM out/ || true |
| 132 | +
|
| 133 | + - uses: actions/upload-artifact@v4 |
| 134 | + with: |
| 135 | + name: Build Output |
| 136 | + path: ./out/ |
0 commit comments