macos-13 #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 7.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 }} | |
outputs: | |
BUILD_VERSION: ${{ env.BUILD_VERSION }} | |
ANDROID_VERSION: ${{ env.ANDROID_VERSION }} | |
# --------------------------------------------------------------------------------------- | |
build_desktop: | |
needs: set_version | |
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: 7.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 | |
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: 7.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: Dotnet Publish | |
working-directory: ./RbfxTemplate.Android | |
run: dotnet publish -f net8.0-android -c Release --no-restore -p:AndroidVersionCode=${{ needs.set_version.outputs.ANDROID_VERSION }} -p:AndroidSdkDirectory=$ANDROID_HOME -p:Version=${{ needs.set_version.outputs.BUILD_VERSION }} | |
- 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 | |
# --------------------------------------------------------------------------------------- | |
build_uwp: | |
needs: set_version | |
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: 7.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 }} |