Skip to content

Commit

Permalink
update release script
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaBs committed Jan 22, 2023
1 parent 2728e62 commit b0729b5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 25 deletions.
25 changes: 0 additions & 25 deletions release.ps1

This file was deleted.

49 changes: 49 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
export CMLLIB_RELEASE_VERSION_NAME

if [ "$1" != "" ]; then
versionName=$1
elif [ "$CMLLIB_RELEASE_VERSION_NAME" != "" ]; then
versionName=$CMLLIB_RELEASE_VERSION_NAME;
else
echo "Error: Specify version name"
exit
fi

baseDir=$(dirname "$0")

csprojCmlLib="${baseDir}/CmlLib/CmlLib.csproj"
csprojCmlLibCoreSample="${baseDir}/CmlLibCoreSample/CmlLibCoreSample.csproj"
csprojCmlLibWinFormSample="${baseDir}/CmlLibWinFormSample/CmlLibWinFormSample.csproj"

[ ! -f $csprojCmlLib ] && { echo "Cannot find CmlLib.csproj file"; exit; }
[ ! -f $csprojCmlLibCoreSample ] && { echo "Cannot find CmlLibCoreSample.csproj file"; exit; }
[ ! -f $csprojCmlLibWinFormSample ] && { echo "Cannot find CmlLibWinFormSample.csproj file"; exit; }

outDir="${baseDir}/release"
publishDir="${outDir}/CmlLib.Core.${versionName}"
sampleCoreLauncherDir="${outDir}/SampleCoreLauncher"
sampleWinFormLauncherDir="${outDir}/SampleWinFormLauncher"

if [ -d $outDir ]; then
rm -r $outDir || { echo "Failed to remove output directory: ${outDir}"; exit; }
fi

echo
echo "Packing nupkg file..."
dotnet pack "$csprojCmlLib" -o "$outDir" -c Release || exit;

echo
echo "Publishing CmlLibCoreSample project..."
dotnet publish "$csprojCmlLibCoreSample" -o "$sampleCoreLauncherDir" -c Release --no-self-contained || exit;
tar -zcvf "${sampleCoreLauncherDir}.tar.gz" "$sampleCoreLauncherDir"
rm -rf "${sampleCoreLauncherDir}"

echo
echo "Publishing CmlLibWinFormSample project..."
dotnet publish "$csprojCmlLibWinFormSample" -o "$sampleWinFormLauncherDir" -c Release --no-self-contained || exit;
tar -zcvf "${sampleWinFormSample}.tar.gz" "$sampleWinFormLauncherDir"
rm -rf "${sampleWinFormLauncherDir}"

echo
echo "Done"

0 comments on commit b0729b5

Please sign in to comment.