Skip to content

Commit 84ffc9e

Browse files
Github Actions for building and packing macOS executables (#330)
* fix: browse button not working on standalone mac Apparently, the last official update for the StandaloneFileBrowser was in 2018, before the adoption from Apple to AppleSilicon in 2021. Because of this, it creates a bug when creating a universal build on Unity (Intel + AppleSilicon) making the "Browse" button from the song folder manager not work anymore. This replaces the current StandaloneFileBrowser.bundle and uses a .bundle (+ .meta) created by tonidurans that has added support to AppleSilicon Tested using an Intel-based machine running an Intel + Apple Silicon (universal) build. Still need testing for Apple Silicon. tldr: i just grabbed the .bundle + .meta from this pr (gkngkc/UnityStandaloneFileBrowser#116) and put on the project and now it works 👍 * Update Credits.txt * feat(workflow): request manual activation file * feat(workflow): setup builder * chore(workflow): disable linux test (for now) * chore: remove build.yml + feat: build-mac.yml (12-core) * chore(workflow/mac-builder): remove need for 12-core machine got carried away and got long pickup line * feat(workflow/mac-builder): enable caching workflow takes 15 MINUTES JUST FOR INSTALLING UNITY * fix(workflow/mac-builder): wrong build path * fix(workflow/mac-builder): install missing library * chore(workflow/mac-builder): use latest version for unity-builder * feat(workflow/mac-builder): add names for unamed jobs * feat(workflow/mac-builder): restore nuget packages * fix(workflow/mac-builder): remove double-quotes * test(workflow/mac-builder): check what dotnet version is installed * feat(workflow/mac-builder): merge python commands * ok i don't know how to use it * chore(workflow/mac-builder): change unity-builder version to 2.2.0 * feat(workflow/mac-builder): enable continue-on-error on builder job * chore(workflow/mac-builder): remove python installation it already comes installed in apparently * feat(workflow/mac-builder): merge nuget commands * feat(workflow/mac-builder): add blender installation * fix(workflow/mac-version): using wrong python version * chore(workflow/mac-builder): install an older blender version (3.4.1) * feat(workflow/mac-builder): add compress file * chore(workflow): change mac workflow file name * fix(workflow/mac-builder): use another compressor method * chore(workflow/mac-builder): remove concurrency cancel-in-progress * feat(workflow/mac-builder): add quarantine command * fix(workflow/mac-builder): run quarantine as sudo * chore(workflow/mac-builder): remove quarantine command * feat(workflow/mac-builder): create dmg * fix(workflow/mac-builder): fix wrong extension * chore(workflow/mac-builder): remove retention-days * fix(workflow/mac-builder): missing && on commands end * feat(workflow/mac-builder): add continue-on-error on create dmg * fix(workflow/mac-builder): separate rename dmg to a different job * Revert "feat(workflow/mac-builder): create dmg" Revert "feat(workflow/mac-builder): create dmg" This reverts commit 0bc0e4c. * feat(workflow/mac-builder): add caching to git lts * fix(workflow/mac-builder): fix wrong extension (2) * feat(workflow/mac-builder): add caching to blender * fix(workflow/mac-builder): blender cache missing folder * fix(workflow/mac-builder): wrong blenderinstall folder * feat(workflow/mac-builder): add commit blenderinstall * chore(workflow/mac-builder): enable dirty build * fix(workflow/mac-builder): wrong blenderinstall folder * fix(workflow/mac-builder): remove git reset * feat(workflow/mac-builder): remove lfs cache maybe this is causing some errors on build * feat(workflow/mac-builder): add inputs to workflow_dispatch * feat(workflow/mac-builder): change from choice to boolean * feat(workflow/mac-builder): move blenderinstall to temp/ folder * fix(workflow/mac-builder): temp folder not existing when creating blenderinstall folder * feat(workflow/mac-builder): remove write access to blender.dmg after install * feat(workflow/mac-builder): move blenderinstall to runner.temp * feat(workflow/mac-builder): remove job matrix * feat(workflow): new mac fixer workflow * temporary commit: check what files on main folder * chore(workflow/macbuild-fix): change getLatestRelease package * chore(workflow/macbuild-fix): fix find and unzip command * fix(workflow/macbuild-fix): specify type on find and unzip command * chore(workflow/macbuild-fix): remove unzip command * fix(workflow/macbuild-fix): wrong zip destination * chore(workflow/macbuild-fix): remove temporary "ls" command * fix(workflow/macbuild-fix): reorder permission steps * chore(workflow/macbuild-fix): change exec to execdir * chore(workflow/macbuild-fix): remove -print * (workflow/macbuild-fix): remove check for xattr * (workflow/macbuild-fix): apply permission recursivly * feat(workflow/macbuild-fix): add .tar.bz2 type * feat(workflow/macbuild-fix): add quarantine command * feat(workflow/mac-builder): add .tar.bz2 option * fix(workflow/mac-builder): remove unexpected symbol at end of command * feat(workflow/macbuild-fix): change job name --------- Co-authored-by: EliteAsian <lavasnakegaming@gmail.com>
1 parent 281a2d0 commit 84ffc9e

File tree

3 files changed

+266
-0
lines changed

3 files changed

+266
-0
lines changed

.github/workflows/activation.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Acquire activation file
2+
on:
3+
workflow_dispatch: {}
4+
jobs:
5+
activation:
6+
name: Request manual activation file 🔑
7+
runs-on: ubuntu-latest
8+
steps:
9+
# Request manual activation file
10+
- name: Request manual activation file
11+
id: getManualLicenseFile
12+
uses: game-ci/unity-request-activation-file@v2
13+
with:
14+
unityVersion: "2021.3.21f1"
15+
# Upload artifact (Unity_v20XX.X.XXXX.alf)
16+
- name: Expose as artifact
17+
uses: actions/upload-artifact@v2
18+
with:
19+
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
20+
path: ${{ steps.getManualLicenseFile.outputs.filePath }}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: Builds - MacOS (release)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version (x.xx.x)"
8+
required: true
9+
type: string
10+
createZip:
11+
description: "Create .zip file"
12+
default: true
13+
type: boolean
14+
createTar:
15+
description: "Create .tar.bz2 file"
16+
default: true
17+
type: boolean
18+
createDmg:
19+
description: "Create .dmg file"
20+
default: true
21+
type: boolean
22+
23+
# concurrency:
24+
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
# cancel-in-progress: true
26+
27+
jobs:
28+
macBuilder:
29+
name: Mac Build for v${{ inputs.version }}
30+
runs-on: macos-latest
31+
32+
steps:
33+
###########################
34+
# Checkout #
35+
###########################
36+
- name: "[Pre-install] Pull project"
37+
uses: actions/checkout@v3
38+
with:
39+
lfs: true
40+
41+
###########################
42+
# Cache #
43+
###########################
44+
- name: "[Pre-install] Restore 'library' cache"
45+
uses: actions/cache@v3
46+
with:
47+
path: Library
48+
key: YARG-Library-macos-StandaloneOSX
49+
restore-keys: |
50+
YARG-Library-macos-
51+
YARG-Library-
52+
53+
###########################
54+
# Install Blender #
55+
###########################
56+
57+
58+
- name: "[Pre-install] Get Blender (3.4.1) from cache"
59+
id: blender
60+
uses: actions/cache@v3
61+
with:
62+
path: ${{ runner.temp }}/BlenderInstall
63+
key: blender-3.4.1
64+
restore-keys: blender-
65+
66+
- if: ${{ steps.blender.outputs.cache-hit != 'true' }}
67+
name: "[Pre-install] Download Blender (3.4.1)"
68+
continue-on-error: true
69+
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
70+
71+
# - name: "[Pre-install] Install Blender"
72+
# run: brew install --cask blender
73+
74+
- name: "[Pre-install] Install Blender (3.4.1)"
75+
run: >
76+
hdiutil attach ${{ runner.temp }}/BlenderInstall/blender.dmg &&
77+
cp -R /Volumes/Blender/Blender.app /Applications &&
78+
hdiutil unmount /Volumes/Blender
79+
80+
###########################
81+
# Install Libraries #
82+
###########################
83+
- name: "[Pre-install] Install Libraries"
84+
run: pip3 install requests && python3 InstallLibraries/install.py
85+
86+
###########################
87+
# Restore Packages #
88+
###########################
89+
- name: "[Pre-install] Restoring NuGet Packages"
90+
run: dotnet tool install --global NuGetForUnity.Cli && nugetforunity restore
91+
92+
###########################
93+
# Build #
94+
###########################
95+
- name: "[Build] Run Builder"
96+
uses: game-ci/unity-builder@v2.2.0
97+
continue-on-error: true
98+
env:
99+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
100+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
101+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
102+
with:
103+
buildName: YARG
104+
unityVersion: 2021.3.21f1
105+
targetPlatform: StandaloneOSX
106+
cacheUnityInstallationOnMac: true
107+
108+
###########################
109+
# Compress #
110+
###########################
111+
- if: ${{ inputs.createZip == true }}
112+
name: "[Post-build] Compress to a .zip"
113+
run: ditto -c -k --keepParent build/StandaloneOSX/YARG.app YARG_v${{ inputs.version }}-MacOS-Universal.zip
114+
115+
- if: ${{ inputs.createZip == true }}
116+
name: "[Post-build] Upload .zip to artifacts"
117+
uses: actions/upload-artifact@v3
118+
with:
119+
name: YARG_v${{ inputs.version }}-MacOS-Universal.zip
120+
path: YARG_v${{ inputs.version }}-MacOS-Universal.zip
121+
122+
###########################
123+
# Compress .tar.bz2 #
124+
###########################
125+
126+
- if: ${{ inputs.createTar == true }}
127+
name: "[Post-build] Compress to a .tar.bz2"
128+
run: tar --xattrs -c -j -f YARG_v${{ inputs.version }}-MacOS-Universal.tar.bz2 build/StandaloneOSX/YARG.app
129+
130+
- if: ${{ inputs.createTar == true }}
131+
name: "[Post-build] Upload .tar.bz2 to artifacts"
132+
uses: actions/upload-artifact@v3
133+
with:
134+
name: YARG_v${{ inputs.version }}-MacOS-Universal.tar.bz2
135+
path: YARG_v${{ inputs.version }}-MacOS-Universal.tar.bz2
136+
137+
###########################
138+
# Create .DMG #
139+
###########################
140+
- if: ${{ inputs.createDmg == true }}
141+
name: "[Post-build] Create .dmg"
142+
continue-on-error: true
143+
run: >
144+
echo "- Installing create-dmg" &&
145+
brew install graphicsmagick imagemagick &&
146+
npm install --global create-dmg &&
147+
echo "- Creating DMG" &&
148+
create-dmg build/StandaloneOSX/YARG.app --dmg-title=YARG
149+
150+
- if: ${{ inputs.createDmg == true }}
151+
name: "[Post-build] Rename .dmg"
152+
run: find . -name *.dmg -print -exec mv {} "YARG_v${{ inputs.version }}-MacOS-Universal.dmg" \;
153+
154+
- if: ${{ inputs.createDmg == true }}
155+
name: "[Post-build] Upload .dmg to artifacts"
156+
uses: actions/upload-artifact@v3
157+
with:
158+
name: YARG_v${{ inputs.version }}-MacOS-Universal.dmg
159+
path: YARG_v${{ inputs.version }}-MacOS-Universal.dmg
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Fix macOS permissions on latest released build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version (\"vX.XX.X\" or \"latest\")"
8+
default: "latest"
9+
required: true
10+
type: string
11+
createZip:
12+
description: "Create .zip file"
13+
default: true
14+
type: boolean
15+
createTar:
16+
description: "Create .tar.bz2 file"
17+
default: true
18+
type: boolean
19+
createDmg:
20+
description: "Create .dmg file"
21+
default: true
22+
type: boolean
23+
24+
env:
25+
repository: YARC-Official/YARG
26+
fileName: "*.zip"
27+
extract: true
28+
29+
jobs:
30+
fixMacBuild:
31+
name: Fixing Mac permissions for ${{ inputs.version }}
32+
runs-on: macos-latest
33+
34+
steps:
35+
- if: ${{ inputs.version == 'latest' }}
36+
name: Get Latest Release
37+
uses: robinraju/release-downloader@v1.8
38+
with:
39+
repository: ${{ env.repository }}
40+
fileName: ${{ env.fileName }}
41+
extract: ${{ env.extract }}
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
latest: true
44+
45+
- if: ${{ inputs.version != 'latest' }}
46+
name: Get specific release (${{ inputs.version }})
47+
uses: robinraju/release-downloader@v1.8
48+
with:
49+
repository: ${{ env.repository }}
50+
fileName: ${{ env.fileName }}
51+
extract: ${{ env.extract }}
52+
token: ${{ secrets.GITHUB_TOKEN }}
53+
tag: ${{ inputs.version }}
54+
55+
- name: Fix permissions
56+
run: find . -name *.app -execdir chmod -R +x {}/Contents/MacOS \;
57+
58+
- name: Fix file attributes
59+
run: find . -name *.app -execdir xattr -cr {} \; -execdir xattr -rd com.apple.quarantine {} \;
60+
61+
- name: Create Packages folder
62+
run: mkdir Packages
63+
64+
- if: ${{ inputs.createZip == true }}
65+
name: "Creating .zip"
66+
run: find . -name *.app -execdir ditto -c -k --keepParent {} Packages/{}.zip \;
67+
68+
- if: ${{ inputs.createTar == true }}
69+
name: "Creating .tar.bz2"
70+
run: find . -name *.app -execdir tar --xattrs -c -j -f Packages/{}.tar.bz2 {} \;
71+
72+
- name: "Creating .dmg"
73+
if: ${{ inputs.createDmg == true }}
74+
continue-on-error: true
75+
run: >
76+
echo "- Installing create-dmg" &&
77+
brew install graphicsmagick imagemagick &&
78+
npm install --global create-dmg &&
79+
echo "- Creating DMG" &&
80+
find . -name *.app -execdir create-dmg --dmg-title=YARG {} Packages \;
81+
82+
83+
- name: "Upload pacakges to artifacts"
84+
uses: actions/upload-artifact@v3
85+
with:
86+
name: Packages
87+
path: Packages

0 commit comments

Comments
 (0)