Skip to content

Commit 4e9ee97

Browse files
authored
Merge pull request #70 from raulsntos/publish-nuget
2 parents 9080ead + e244d6f commit 4e9ee97

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

build-release.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,35 @@ sign_macos_template() {
8888
ssh "${OSX_HOST}" "rm -rf ${_macos_tmpdir}"
8989
}
9090

91+
can_publish_nuget=0
92+
if [ ! -z "${NUGET_SOURCE}" ] && [ ! -z "${NUGET_API_KEY}" ] && [[ $(type -P "dotnet") ]]; then
93+
can_publish_nuget=1
94+
else
95+
echo "Disabling NuGet package publishing as config.sh does not define the required data (NUGET_SOURCE, NUGET_API_KEY), or dotnet can't be found in PATH."
96+
fi
97+
98+
publish_nuget_packages() {
99+
if [ $can_publish_nuget == 0 ]; then
100+
return
101+
fi
102+
dotnet nuget push $1 --source "${NUGET_SOURCE}" --api-key "${NUGET_API_KEY}" --skip-duplicate
103+
}
104+
91105
godot_version=""
92106
templates_version=""
93107
build_classical=1
94108
build_mono=1
109+
publish_nuget=0
95110

96-
while getopts "h?v:t:b:" opt; do
111+
while getopts "h?v:t:b:-:" opt; do
97112
case "$opt" in
98113
h|\?)
99114
echo "Usage: $0 [OPTIONS...]"
100115
echo
101116
echo " -v godot version (e.g: 3.2-stable) [mandatory]"
102117
echo " -t templates version (e.g. 3.2.stable) [mandatory]"
103118
echo " -b all|classical|mono (default: all)"
119+
echo " --publish-nuget (default: false)"
104120
echo
105121
exit 1
106122
;;
@@ -117,6 +133,19 @@ while getopts "h?v:t:b:" opt; do
117133
build_classical=0
118134
fi
119135
;;
136+
-)
137+
case "${OPTARG}" in
138+
publish-nuget)
139+
publish_nuget=1
140+
;;
141+
*)
142+
if [ "$OPTERR" == 1 ] && [ "${optspec:0:1}" != ":" ]; then
143+
echo "Unknown option --${OPTARG}."
144+
exit 1
145+
fi
146+
;;
147+
esac
148+
;;
120149
esac
121150
done
122151

@@ -481,6 +510,12 @@ if [ "${build_mono}" == "1" ]; then
481510
cp SHA512-SUMS.txt ${basedir}/sha512sums/${godot_version}/mono/
482511
popd
483512

513+
# NuGet packages
514+
if [ "${publish_nuget}" == "1" ]; then
515+
echo "Publishing NuGet packages..."
516+
publish_nuget_packages out/linux/x86_64/tools-mono/GodotSharp/Tools/nupkgs/*.nupkg
517+
fi
518+
484519
fi
485520

486521
echo "All editor binaries and templates prepared successfully for release"

config.sh.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ export OSX_BUNDLE_ID=""
4242
export APPLE_ID=""
4343
export APPLE_ID_PASSWORD=""
4444

45+
# NuGet source for publishing .NET packages
46+
export NUGET_SOURCE="nuget.org"
47+
# API key for publishing NuGet packages to nuget.org
48+
export NUGET_API_KEY=""

0 commit comments

Comments
 (0)