forked from splitice/IPTables.Net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuget-upload.sh
More file actions
31 lines (22 loc) · 821 Bytes
/
nuget-upload.sh
File metadata and controls
31 lines (22 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
set -e
DIR=~/repo
P=$DIR/$1
cd $P
VERSION=$(git describe --abbrev=0 --tags)
REVISION=$(git log "$VERSION..HEAD" --oneline | wc -l)
re="([0-9]+\.[0-9]+\.[0-9]+)"
if [[ $VERSION =~ $re ]]; then
VERSION_STR="${BASH_REMATCH[1]}"
padded=$(printf "%04d" $REVISION)
if [[ "$REVISION" != "0" ]]; then
LAST_PART=$(echo "$VERSION_STR" | sed 's/.\+\([0-9]\+\)$/\1/')
let LAST_PART=$LAST_PART+1
VERSION_STR=$(echo "$VERSION_STR" | sed 's/\.\([0-9]\+\)$/.'$LAST_PART'/')
VERSION_STR="$VERSION_STR-cibuild$padded"
fi
echo "Version of $1 is now: $VERSION_STR"
fi
if [ "${CIRCLE_PULL_REQUEST}" = "" ]; then
dotnet pack --configuration Release /p:Version=$VERSION_STR
dotnet nuget push bin/Release/*.nupkg --api-key $NUGET_API -s https://www.nuget.org/api/v2/package
fi