Skip to content

0.3.7.813

0.3.7.813 #53

Workflow file for this run

name: BuildGame
on:
push:
branches: [ "master", "main" ]
jobs:
# ---------------------------------------------------------------------------------------
set_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore tools
run: dotnet tool restore
- name: Get version
run: dotnet tool run ezpipeline git-height-version -- -b 0.0.1 -v BUILD_VERSION
- name: Get android version
run: dotnet tool run ezpipeline git-height-version -- -v ANDROID_VERSION
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: v${{ env.BUILD_VERSION }}
tag_name: v${{ env.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check for Secret PLAY_KEYSTORE
id: secret-check
run: |
if [ "${{ secrets.PLAY_KEYSTORE }}" != '' ]; then
echo "HAS_PLAY_KEYSTORE=true" >> $GITHUB_ENV
else
echo "HAS_PLAY_KEYSTORE=false" >> $GITHUB_ENV
fi
outputs:
BUILD_VERSION: ${{ env.BUILD_VERSION }}
ANDROID_VERSION: ${{ env.ANDROID_VERSION }}
HAS_PLAY_KEYSTORE: ${{ env.HAS_PLAY_KEYSTORE }}
# ---------------------------------------------------------------------------------------
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore tools
run: dotnet tool restore
- name: Test in Debug configuration
working-directory: ./RbfxTemplate.Tests
run: dotnet test --configuration Debug --verbosity normal
- name: Test in Release configuration
working-directory: ./RbfxTemplate.Tests
run: dotnet test --configuration Release --verbosity normal
# ---------------------------------------------------------------------------------------
build_desktop:
needs: [set_version, tests]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Evaluate target runtime
shell: bash
run: |
echo "OS: $OSTYPE"
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "RUNTIME_ID: osx-x64"
echo "RUNTIME_ID=osx-x64" >> $GITHUB_ENV
elif [[ "$OSTYPE" == "linux"* ]]; then
echo "RUNTIME_ID: linux-x64"
echo "RUNTIME_ID=linux-x64" >> $GITHUB_ENV
elif [[ "$OSTYPE" == "msys"* ]]; then
echo "RUNTIME_ID: win-x64"
echo "RUNTIME_ID=win-x64" >> $GITHUB_ENV
else
echo "Unrecognized OS type $OSTYPE"
exit 1
fi
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore tools
run: dotnet tool restore
- name: Restore dependencies
working-directory: ./RbfxTemplate.Desktop
run: dotnet restore
- name: Dotnet Publish
working-directory: ./RbfxTemplate.Desktop
run: dotnet publish -f net8.0 -c Release --runtime ${{ env.RUNTIME_ID }} --self-contained true -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
- name: Copy runtime dlls
if: ${{ env.RUNTIME_ID == 'win-x64' }}
run: |
copy "C:/Windows/System32/MSVCP140.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
copy "C:/Windows/System32/VCRUNTIME140.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
copy "C:/Windows/System32/VCRUNTIME140_1.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
copy "C:/Windows/System32/D3DCOMPILER_47.dll" "RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/"
- name: Zip Package
run: dotnet tool run ezpipeline -- zip -i RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/ -o RbfxTemplate.${{ env.RUNTIME_ID }}.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./RbfxTemplate.${{ env.RUNTIME_ID }}.zip
name: v${{ needs.set_version.outputs.BUILD_VERSION }}
tag_name: v${{ needs.set_version.outputs.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Release to itch.io ${{ vars.ITCH_PROJECT }}
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
if: ${{ env.BUTLER_API_KEY != '' && vars.ITCH_PROJECT != '' }}
run: |
dotnet tool run ezpipeline -- fetch-tool --name Butler -o tools/itch
tools/itch/butler push RbfxTemplate.Desktop/bin/Release/net8.0/${{ env.RUNTIME_ID }}/publish/ ${{ vars.ITCH_PROJECT }}:${{ env.RUNTIME_ID }}
shell: bash
# ---------------------------------------------------------------------------------------
build_android:
needs: [set_version, tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore tools
run: dotnet tool restore
- name: Install Workloads
run: dotnet workload install android
- name: Restore dependencies
working-directory: ./RbfxTemplate.Android
run: dotnet restore
- name: Install android-sdk
shell: bash
run: |
sudo apt-get install -y wget tar android-sdk unzip tree
echo $ANDROID_HOME
sudo chmod -R a+rw $ANDROID_HOME
- name: Fetch AndroidSDKManager
run: |
dotnet tool run ezpipeline fetch-tool -n AndroidSDKManager --output $ANDROID_HOME --path --version 9123335
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses --sdk_root=$ANDROID_HOME
- name: 'Print Java version'
run: javac -version
- name: Install Android SDK and Platforms
run: $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platform-tools" "platforms;android-33" --sdk_root=$ANDROID_HOME
- name: Decode Keystore
id: decode_keystore
if: ${{ needs.set_version.outputs.HAS_PLAY_KEYSTORE == 'true' }}
uses: timheuer/base64-to-file@v1
with:
fileDir: '${{ github.workspace }}/RbfxTemplate.Android'
fileName: 'googleplay.jks'
encodedString: ${{ secrets.PLAY_KEYSTORE }}
- name: Extract ApplicationId from RbfxTemplate.Android.csproj
working-directory: ./RbfxTemplate.Android
run: |
dotnet tool run ezpipeline get-msbuild-property -i RbfxTemplate.Android.csproj -p ApplicationId -v ANDROID_PACKAGENAME
- name: Dotnet Publish
working-directory: ./RbfxTemplate.Android
run: |
if [ -n "${{ secrets.PLAY_KEYSTORE }}" ]; then
echo "Secret PLAY_KEYSTORE is defined. Building and signing the aab file."
dotnet publish -f net8.0-android -c Release --no-restore -p:ApplicationId=${{ env.ANDROID_PACKAGENAME }} -p:ApplicationDisplayVersion=${{ needs.set_version.outputs.BUILD_VERSION }} -p:ApplicationVersion=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }} /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=googleplay.jks /p:AndroidSigningKeyAlias=${{secrets.PLAY_KEYSTORE_ALIAS}} /p:AndroidSigningKeyPass="${{ secrets.PLAY_KEYSTORE_PASS }}" /p:AndroidSigningStorePass="${{ secrets.PLAY_KEYSTORE_PASS }}"
else
echo "Secret PLAY_KEYSTORE is not defined. Building with no signature."
dotnet publish -f net8.0-android -c Release --no-restore -p:ApplicationId=${{ env.ANDROID_PACKAGENAME }} -p:ApplicationDisplayVersion=${{ needs.set_version.outputs.BUILD_VERSION }} -p:ApplicationVersion=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
fi
- name: Find APK
run: |
dotnet tool run ezpipeline resolve-path -i ./RbfxTemplate.Android/bin/Release/**/*-Signed.apk -v APK_PATH
dotnet tool run ezpipeline resolve-path -i ./RbfxTemplate.Android/bin/Release/**/*-Signed.aab -v AAB_PATH
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.APK_PATH }}
${{ env.AAB_PATH }}
name: v${{ needs.set_version.outputs.BUILD_VERSION }}
tag_name: v${{ needs.set_version.outputs.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Release to itch.io ${{ vars.ITCH_PROJECT }}
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
if: ${{ env.BUTLER_API_KEY != '' && vars.ITCH_PROJECT != '' }}
run: |
dotnet tool run ezpipeline -- fetch-tool --name Butler -o tools/itch
tools/itch/butler push ${{ env.APK_PATH }} ${{ vars.ITCH_PROJECT }}:android
shell: bash
- uses: r0adkll/[email protected]
name: Upload Android Artifact to Play Console
env:
PLAYSTORE_SERVICE_ACC: ${{ secrets.PLAYSTORE_SERVICE_ACC }}
if: ${{ env.PLAYSTORE_SERVICE_ACC != '' }}
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_SERVICE_ACC }}
packageName: ${{ env.ANDROID_PACKAGENAME }}
releaseFiles: ${{ env.AAB_PATH }}
track: internal
# ---------------------------------------------------------------------------------------
build_uwp:
needs: [set_version, tests]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Restore tools
run: dotnet tool restore
- name: Restore application
working-directory: ./RbfxTemplate.UWP
run: msbuild RbfxTemplate.UWP.csproj /t:Restore /p:Configuration=Release
- name: Patch manifest version
working-directory: ./RbfxTemplate.UWP
run: dotnet tool run ezpipeline -- set-xml -i Package.appxmanifest -p default:Package/default:Identity -a Version -v ${{ needs.set_version.outputs.BUILD_VERSION }}.0
- name: Dotnet Publish
working-directory: ./RbfxTemplate.UWP
run: msbuild RbfxTemplate.UWP.csproj /p:AppxPackageDir=appxupload /p:AppxBundle=Always /p:AppxBundlePlatforms="x64" /p:Platform=x64 /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=StoreUpload /p:Configuration=Release /p:Version=${{ needs.set_version.outputs.BUILD_VERSION }}
- name: Zip Package
run: dotnet tool run ezpipeline -- zip -i RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP_${{ needs.set_version.outputs.BUILD_VERSION }}.0_Test -o RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP.x64.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP_${{ needs.set_version.outputs.BUILD_VERSION }}.0_x64_bundle.appxupload
RbfxTemplate.UWP/appxupload/RbfxTemplate.UWP.x64.zip
name: v${{ needs.set_version.outputs.BUILD_VERSION }}
tag_name: v${{ needs.set_version.outputs.BUILD_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}