name: Build project on: push: branches: - '**' tags-ignore: - '**' pull_request: branches: - '**' env: ITCH_USERNAME: redzuzu # Replace with your itch.io username ITCH_GAME_ID: stellar-xipher # Replace with your itch.io game ID jobs: buildForAllSupportedPlatforms: name: Build for runs-on: ubuntu-latest strategy: fail-fast: false matrix: unityVersion: - 6000.0.37f1 targetPlatform: - StandaloneWindows64 # Windows 64-bit standalone - StandaloneLinux64 # Linux 64-bit standalone steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Clean Library and Build folder run: | rm -rf Library - uses: actions/cache@v4 with: path: Library key: Library-${{ matrix.unityVersion }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} restore-keys: | Library-${{ matrix.unityVersion }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} Library- - name: Debug - List project files run: | ls -R - uses: https://github.com/game-ci/unity-builder@v4 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} DOCKER_DEFAULT_PLATFORM: linux/amd64 with: runAsHostUser: true unityVersion: ${{ matrix.unityVersion }} targetPlatform: ${{ matrix.targetPlatform }} #customParameters: -logFile /dev/stdout -batchmode -nographics -quit - name: Zip build artifacts run: | mkdir -p /tmp/zipped_builds rm -rf /tmp/zipped_builds/${{ matrix.targetPlatform }}.zip 2> /dev/null if [ "${{ matrix.targetPlatform }}" == "StandaloneLinux64" ]; then cd build/StandaloneLinux64 zip -r /tmp/zipped_builds/build_StandaloneLinux64.zip . \ -x "StandaloneLinux64_BackUpThisFolder_ButDontShipItWithYourGame/**" \ -x "StellarXipher_BurstDebugInformation_DoNotShip/**" cd ../.. elif [ "${{ matrix.targetPlatform }}" == "StandaloneWindows64" ]; then cd build/StandaloneWindows64 zip -r /tmp/zipped_builds/build_StandaloneWindows64.zip . \ -x "StellarXipher_BurstDebugInformation_DoNotShip/**" cd ../.. fi - name: Debug - List files in /tmp/zipped_builds run: | ls -R /tmp/zipped_builds - name: Determine tag name id: tag shell: bash run: | BUILD_NUMBER="$(git rev-list --count HEAD)" SHORT_HASH="$(git rev-parse --short=7 HEAD)" if [[ "${{ github.ref_name }}" == "main" ]]; then echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT else SAFE_NAME=$(echo "${{ github.ref_name }}" | tr '/' '-') echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT fi - name: Create Gitea Release and Upload Assets uses: akkuman/gitea-release-action@v1 env: NODE_OPTIONS: '--max-old-space-size=4096' GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} with: server_url: ${{ github.server_url }} tag_name: ${{ steps.tag.outputs.name }} name: Release ${{ steps.tag.outputs.name }} draft: false prerelease: false files: | /tmp/zipped_builds/build_${{ matrix.targetPlatform }}.zip md5sum: true sha256sum: false publishToItch: name: Publish itch.io runs-on: ubuntu-latest needs: buildForAllSupportedPlatforms strategy: matrix: targetPlatform: - StandaloneWindows64 - StandaloneLinux64 steps: - name: Copy build zip to current directory run: | ls /tmp/zipped_builds - name: Publish to itch.io uses: KikimoraGames/itch-publish@v0.0.3 with: butlerApiKey: ${{ secrets.BUTLER_API_KEY }} gameData: /tmp/zipped_builds/build_${{ matrix.targetPlatform }}.zip itchUsername: ${{ env.ITCH_USERNAME }} itchGameId: ${{ env.ITCH_GAME_ID }} buildChannel: ${{ matrix.targetPlatform }} buildNumber: ${{ needs.buildForAllSupportedPlatforms.outputs.tag.name }}