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"