diff --git a/.github/workflows/build-game-bridge.yaml b/.github/workflows/build-game-bridge.yaml index 817d4c0bb4..d5c5ca1c22 100644 --- a/.github/workflows/build-game-bridge.yaml +++ b/.github/workflows/build-game-bridge.yaml @@ -31,6 +31,7 @@ env: DRY_RUN: ${{ github.event.inputs.dry_run }} GH_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }} SDK_TEAM_MEMBERS: ${{ secrets.SDK_TEAM_MEMBERS }} + CI: ${{ github.env.CI }} jobs: build-game-bridge: @@ -64,7 +65,7 @@ jobs: run: echo "TS_SDK_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV - name: Build Game Bridge - run: yarn nx run @imtbl/game-bridge:build + run: yarn nx run @imtbl/game-bridge:build --skip-nx-cache - name: Cache build artifacts uses: actions/cache@v4 @@ -72,6 +73,11 @@ jobs: path: ./packages/game-bridge/dist key: "${{ runner.os }}-game-bridge-build-${{ env.TS_SDK_TAG }}" + - name: Upload Game Bridge Build + uses: actions/upload-artifact@v4 + with: + path: ./packages/game-bridge/dist + create-unity-pr: name: Create Unity PR needs: build-game-bridge @@ -192,11 +198,9 @@ jobs: cd .. - name: Copy Game Bridge Build - # TODO: Update this to copy the correct file run: cp -r ./packages/game-bridge/dist/unreal/index.js ./unreal-immutable-sdk/Web/index.js - name: Commit Changes - # TODO: Update this to copy the correct file run: | cd unreal-immutable-sdk git add Web/index.js diff --git a/packages/game-bridge/scripts/updateSdkVersion.sh b/packages/game-bridge/scripts/updateSdkVersion.sh index ac11326033..fc0a00873d 100755 --- a/packages/game-bridge/scripts/updateSdkVersion.sh +++ b/packages/game-bridge/scripts/updateSdkVersion.sh @@ -6,9 +6,7 @@ # - TS_SDK_HASH: The git hash of the tag set -e -if [ -n "$CI" ]; then - set -x -fi +set -x # The files to update FILE_PATHS=("./dist/unity/index.html" "./dist/unreal/index.js" "./dist/unreal/index.js.map") @@ -22,8 +20,26 @@ do fi done -# Check if running in a CI environment -if [ -n "$CI" ]; then +# if running locally, set the environment variables +if [ -z "$CI" ]; then + export TS_SDK_TAG=$(git describe --tags --abbrev=0) + export TS_SDK_HASH=$(git rev-parse $TS_SDK_TAG) + + # get the hash of the current HEAD + export TS_SDK_LOCAL_HEAD_HASH=$(git rev-parse HEAD) + + # check the hash matches the has from the tag + if [ "$TS_SDK_HASH" != "$TS_SDK_LOCAL_HEAD_HASH" ]; then + # warn the user that the current tag does not match the current HEAD + # but continue with the update + echo "[!!!WARNING!!!]" + echo "[!!!WARNING!!!]" + echo "[!!!WARNING!!!] The current tag does not match the current HEAD. Do not commit this game brige to the Game SDK repos..." + echo "[!!!WARNING!!!]" + echo "[!!!WARNING!!!]" + fi +else + echo "Update SDK version in CI / non-locally" # Get the current branch name current_branch=$(git rev-parse --abbrev-ref HEAD) @@ -57,26 +73,6 @@ if [ -n "$CI" ]; then fi fi -# if running locally, set the environment variables -if [ ! -n "$CI" ]; then - export TS_SDK_TAG=$(git describe --tags --abbrev=0) - export TS_SDK_HASH=$(git rev-parse $TS_SDK_TAG) - - # get the hash of the current HEAD - export TS_SDK_LOCAL_HEAD_HASH=$(git rev-parse HEAD) - - # check the hash matches the has from the tag - if [ "$TS_SDK_HASH" != "$TS_SDK_LOCAL_HEAD_HASH" ]; then - # warn the user that the current tag does not match the current HEAD - # but continue with the update - echo "[!!!WARNING!!!]" - echo "[!!!WARNING!!!]" - echo "[!!!WARNING!!!] The current tag does not match the current HEAD. Do not commit this game brige to the Game SDK repos..." - echo "[!!!WARNING!!!]" - echo "[!!!WARNING!!!]" - fi -fi - echo "Updating __SDK_VERSION__ to $TS_SDK_TAG" echo "Updating __SDK_VERSION_SHA__ to $TS_SDK_HASH"