Skip to content

Builds - Mac (development) #228

Builds - Mac (development)

Builds - Mac (development) #228

Workflow file for this run

name: Builds - Mac (development)
on:
repository_dispatch:
types: [new_edge_build]
workflow_dispatch:
schedule:
- cron: '25 0,12 * * *'
concurrency:
group: mac-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
platform: "MacOS"
unityVersion: "2021.3.21f1"
unityVersionHash: "1b156197d683"
permissions:
contents: write
jobs:
check:
name: "Check for releases"
runs-on: ubuntu-latest
outputs:
runBuild: ${{ steps.check-latest-output.outputs.runBuild }}
messageBody: ${{ steps.check-latest-output.outputs.messageBody }}
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Setup Node"
uses: actions/setup-node@v3
with:
node-version: latest
cache: npm
- name: "Install dependencies"
run: npm i
- name: "Check for latest release / Save information to output"
id: check-latest-output
run: node methods/CheckLatestRelease.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ env.platform }}
macBuilder:
name: Mac Build
needs: [check]
if: needs.check.outputs.runBuild == 'true'
runs-on: macos-latest
timeout-minutes: 90
steps:
###########################
# Checkout #
###########################
- name: "[Pre-install] Pull project"
uses: nschloe/action-cached-lfs-checkout@v1.2.1
with:
repository: YARC-Official/YARG
ref: dev
- name: "[Pre-install] Save commit sha into output"
id: latestCommit
run: |
echo "commitSHA=$(git show-ref | grep refs/remotes/origin/dev | cut -c1-40)" >> "$GITHUB_OUTPUT" &&
echo "commitShortSHA=$(git show-ref | grep refs/remotes/origin/dev | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: "[Pre-install] Pull bleeding-edge repo"
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
path: bleedingedge
###########################
# Cache #
###########################
- name: "[Pre-install] Restore 'library' cache"
uses: actions/cache@v3
with:
path: Library
key: YARG-Library-MacOS-Development
restore-keys: |
YARG-Library-MacOS-
###########################
# Install Blender #
###########################
- name: "[Pre-install] Get Blender (3.4.1) from cache"
id: blender
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/BlenderInstall
key: mac-blender-3.4.1
restore-keys: mac-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
###########################
#Replace icon with nightly#
###########################
- name: "[Pre-build] Replace icon with Nightly/Development"
shell: bash
run: "cp -f bleedingedge/static/Icon_Nightly.png Assets/Art/UI/Icon_Stable.png"
###########################
# Build #
###########################
- name: "[Install] Download Unity Editor + Mac IL2CPP builder"
run: |
mkdir ${{ runner.temp }}/UnityInstall &&
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.pkg" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/MacEditorInstaller/Unity-${{ env.unityVersion }}.pkg &&
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Mac-IL2CPP-Support.pkg" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/MacEditorTargetInstaller/UnitySetup-Mac-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.pkg
- name: "[Install] Install Unity Editor + Mac IL2CPP builder"
run: |
sudo installer -pkg "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.pkg" -target "/" -verbose &&
sudo installer -pkg "${{ runner.temp }}/UnityInstall/UnitySetup-Mac-IL2CPP-Support.pkg" -target "/" -verbose &&
rm -rf "${{ runner.temp }}/UnityInstall"
- name: "[Build] Run Builder"
run: |
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -projectPath ${{ github.workspace }} -buildTarget StandaloneOSX -buildOSXUniversalPlayer ${{ github.workspace }}/build/YARG.app -username ${{ secrets.MAC_UNITY_EMAIL || secrets.UNITY_EMAIL }} -password ${{ secrets.MAC_UNITY_PASSWORD || secrets.UNITY_PASSWORD }} -serial ${{ secrets.MAC_UNITY_SERIAL || secrets.UNITY_SERIAL }} -logfile -
###########################
# Compress #
###########################
- name: "[Post-build] Compress to a .zip"
run: ditto -c -k --keepParent build/YARG.app Release/YARG_${{ steps.latestCommit.outputs.commitSHA }}-MacOS-Universal.zip
###########################
# Upload #
###########################
# - name: "[Post-build] Upload to artifacts"
# uses: actions/upload-artifact@v3
# with:
# name: MacOS Universal
# path: Release
- name: "[Post-build] Upload to releases"
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: Nightly Build - ${{ steps.latestCommit.outputs.commitSHA }}
tag: ${{ steps.latestCommit.outputs.commitShortSHA }}
file: Release/*
file_glob: true
body: ${{ needs.check.outputs.messageBody }}