StellarXipher/.gitea/workflows/build.yml
EthanPisani c9008a590d
All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 28m9s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 21m19s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 21s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 21s
edit cache
2025-02-20 02:51:14 -05:00

133 lines
4.5 KiB
YAML

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: Cache Unity Library (Speeds up builds)
uses: actions/cache@v3
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: 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 to itch.io
runs-on: ubuntu-latest
needs: buildForAllSupportedPlatforms
strategy:
matrix:
targetPlatform:
- StandaloneWindows64
- StandaloneLinux64
steps:
- name: Copy build zip to current directory
run: |
cp /tmp/zipped_builds/build_${{ matrix.targetPlatform }}.zip ./
- name: Publish to itch.io
run: |
export BUTLER_API_KEY=${{ secrets.BUTLER_API_KEY }}
versionArgument=""
if [ "${{ needs.buildForAllSupportedPlatforms.outputs.tag.name }}" != "" ]; then
versionArgument="--userversion ${{ needs.buildForAllSupportedPlatforms.outputs.tag.name }}"
fi
echo "butler push ./build_${{ matrix.targetPlatform }}.zip ${{ env.ITCH_USERNAME }}/${{ env.ITCH_GAME_ID }}:${{ matrix.targetPlatform }} ${versionArgument}"
butler push ./build_${{ matrix.targetPlatform }}.zip ${{ env.ITCH_USERNAME }}/${{ env.ITCH_GAME_ID }}:${{ matrix.targetPlatform }} ${versionArgument}