Skip to content

Instantly share code, notes, and snippets.

@nicetrysean
Created June 5, 2016 00:22
Show Gist options
  • Save nicetrysean/04f7ba7ae96e2a72aae23b8861b3e700 to your computer and use it in GitHub Desktop.
Save nicetrysean/04f7ba7ae96e2a72aae23b8861b3e700 to your computer and use it in GitHub Desktop.
Automate UnityPackage to Github Releases

Update Github Releases with UnityPackage

Github's API can be a bit wordy to work with just in bash, so I'm using github-release to simplify what we're doing.

On OSX you can install it via Homebrew:

brew install github-releases

In my case, I was using Alfred and created a workflow - but the code is applicable to any bash/zsh setup.

read a1 a2 <<< "{query}"

echo -n "$a1"
RESULT=$(mktemp -q -d -t "project-release_"$a1".unitypackage")

open -na /Applications/Unity/Unity.app/Contents/MacOS/Unity --args -projectPath "~/Projects/YourProject" -batchmode -exportPackage "Assets" "$RESULT" -quit

# This isn't super great, but I haven't found a way yet to find and wait for the Unity process without the possibility of accidentally aquiring a zombie/other instance.
sleep 5

github-release release \
	--user CrowsCrowsCrows \
	--repo SecretGame \
	--tag "$a1" \
	--name "SecretGame $a1" \
	--description "$a2" \
	--pre-release
	
github-release upload \
    --user CrowsCrowsCrows \
    --repo SecretGame \
    --tag "$a1" \
    --name "SecretGame $a1" \
	--label "SecretGame.unitypackage" \
	--file "$RESULT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment