Skip to content

Builds - MacOS (release) #7

Builds - MacOS (release)

Builds - MacOS (release) #7

name: Builds - MacOS (release)
on:
workflow_dispatch:
inputs:
version:
description: "Version (x.xx.x)"
required: true
type: string
createZip:
description: "Create .zip file"
default: true
type: boolean
createTar:
description: "Create .tar.bz2 file"
default: true
type: boolean
createDmg:
description: "Create .dmg file"
default: true
type: boolean
# concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# cancel-in-progress: true
jobs:
macBuilder:
name: Mac Build for v${{ inputs.version }}
runs-on: macos-latest
steps:
###########################
# Checkout #
###########################
- name: "[Pre-install] Pull project"
uses: actions/checkout@v3
with:
lfs: true
###########################
# Cache #
###########################
- name: "[Pre-install] Restore 'library' cache"
uses: actions/cache@v3
with:
path: Library
key: YARG-Library-macos-StandaloneOSX
restore-keys: |
YARG-Library-macos-
YARG-Library-
###########################
# Install Blender #
###########################
- name: "[Pre-install] Get Blender (3.4.1) from cache"
id: blender
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/BlenderInstall
key: blender-3.4.1
restore-keys: blender-
- if: ${{ steps.blender.outputs.cache-hit != 'true' }}
name: "[Pre-install] Download Blender (3.4.1)"
continue-on-error: true
run: mkdir ${{ runner.temp }}/BlenderInstall && curl -L -o "${{ runner.temp }}/BlenderInstall/blender.dmg" https://download.blender.org/release/Blender3.4/blender-3.4.1-macos-x64.dmg
# - name: "[Pre-install] Install Blender"
# run: brew install --cask blender
- name: "[Pre-install] Install Blender (3.4.1)"
run: >
hdiutil attach ${{ runner.temp }}/BlenderInstall/blender.dmg &&
cp -R /Volumes/Blender/Blender.app /Applications &&
hdiutil unmount /Volumes/Blender
###########################
# Restore Packages #
###########################
- name: "[Pre-install] Restoring NuGet Packages"
run: dotnet tool install --global NuGetForUnity.Cli && nugetforunity restore
###########################
# Build #
###########################
- name: "[Build] Run Builder"
uses: game-ci/[email protected]
continue-on-error: true
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
buildName: YARG
unityVersion: 2021.3.21f1
targetPlatform: StandaloneOSX
cacheUnityInstallationOnMac: true
###########################
# Compress #
###########################
- if: ${{ inputs.createZip == true }}
name: "[Post-build] Compress to a .zip"
run: ditto -c -k --keepParent build/StandaloneOSX/YARG.app YARG_v${{ inputs.version }}-MacOS-Universal.zip
- if: ${{ inputs.createZip == true }}
name: "[Post-build] Upload .zip to artifacts"
uses: actions/upload-artifact@v3
with:
name: YARG_v${{ inputs.version }}-MacOS-Universal.zip
path: YARG_v${{ inputs.version }}-MacOS-Universal.zip
###########################
# Compress .tar.bz2 #
###########################
- if: ${{ inputs.createTar == true }}
name: "[Post-build] Compress to a .tar.bz2"
run: tar --xattrs -c -j -f YARG_v${{ inputs.version }}-MacOS-Universal.tar.bz2 build/StandaloneOSX/YARG.app
- if: ${{ inputs.createTar == true }}
name: "[Post-build] Upload .tar.bz2 to artifacts"
uses: actions/upload-artifact@v3
with:
name: YARG_v${{ inputs.version }}-MacOS-Universal.tar.bz2
path: YARG_v${{ inputs.version }}-MacOS-Universal.tar.bz2
###########################
# Create .DMG #
###########################
- if: ${{ inputs.createDmg == true }}
name: "[Post-build] Create .dmg"
continue-on-error: true
run: >
echo "- Installing create-dmg" &&
brew install graphicsmagick imagemagick &&
npm install --global create-dmg &&
echo "- Creating DMG" &&
create-dmg build/StandaloneOSX/YARG.app --dmg-title=YARG
- if: ${{ inputs.createDmg == true }}
name: "[Post-build] Rename .dmg"
run: find . -name *.dmg -print -exec mv {} "YARG_v${{ inputs.version }}-MacOS-Universal.dmg" \;
- if: ${{ inputs.createDmg == true }}
name: "[Post-build] Upload .dmg to artifacts"
uses: actions/upload-artifact@v3
with:
name: YARG_v${{ inputs.version }}-MacOS-Universal.dmg
path: YARG_v${{ inputs.version }}-MacOS-Universal.dmg