Skip to content

Commit 0ae47a8

Browse files
committed
dotnettool/{pack,layout}.sh: allow specification of dirs
Allow a caller of pack.sh and layout.sh to specify the location of the package root and output. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent fa61a18 commit 0ae47a8

3 files changed

Lines changed: 29 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ jobs:
401401
run: |
402402
src/shared/DotnetTool/pack.sh --configuration=Release \
403403
--version="${{ needs.prereqs.outputs.version }}" \
404-
--publish-dir=$(pwd)/signed
404+
--package-root=$(pwd)/signed
405405
406406
- name: Upload unsigned package
407407
uses: actions/upload-artifact@v4

src/shared/DotnetTool/layout.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ case "$i" in
2121
CONFIGURATION="${i#*=}"
2222
shift # past argument=value
2323
;;
24+
--output=*)
25+
OUTDIR="${i#*=}"
26+
shift # past argument=value
27+
;;
2428
*)
2529
# unknown option
2630
;;
@@ -42,7 +46,9 @@ CONFIGURATION="${CONFIGURATION:=Debug}"
4246
FRAMEWORK=net8.0
4347

4448
# Outputs
45-
OUTDIR="$PROJ_OUT/nupkg/$CONFIGURATION"
49+
if [ -z "$OUTDIR" ]; then
50+
OUTDIR="$PROJ_OUT/nupkg/$CONFIGURATION"
51+
fi
4652
IMGOUT="$OUTDIR/images"
4753
PAYLOAD="$OUTDIR/payload"
4854
SYMBOLOUT="$OUTDIR/payload.sym"

src/shared/DotnetTool/pack.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ case "$i" in
1212
CONFIGURATION="${i#*=}"
1313
shift # past argument=value
1414
;;
15-
--version=*)
15+
--version=*)
1616
VERSION="${i#*=}"
1717
shift # past argument=value
1818
;;
19-
--publish-dir=*)
20-
PUBLISH_DIR="${i#*=}"
19+
--package-root=*)
20+
PACKAGE_ROOT="${i#*=}"
21+
shift # past argument=value
22+
;;
23+
--output=*)
24+
OUTPUT="${i#*=}"
2125
shift # past argument=value
2226
;;
2327
*)
@@ -38,15 +42,23 @@ SRC="$ROOT/src"
3842
OUT="$ROOT/out"
3943
DOTNET_TOOL="shared/DotnetTool"
4044

41-
if [ -z "$PUBLISH_DIR" ]; then
42-
PUBLISH_DIR="$OUT/$DOTNET_TOOL/nupkg/$CONFIGURATION"
45+
if [ -z "$PACKAGE_ROOT" ]; then
46+
PACKAGE_ROOT="$OUT/$DOTNET_TOOL/nupkg/$CONFIGURATION"
4347
fi
4448

4549
echo "Creating dotnet tool package..."
4650

47-
dotnet pack "$SRC/$DOTNET_TOOL/DotnetTool.csproj" \
48-
/p:Configuration="$CONFIGURATION" \
49-
/p:PackageVersion="$VERSION" \
50-
/p:PublishDir="$PUBLISH_DIR/"
51+
if [ -z "$OUTPUT" ]; then
52+
dotnet pack "$SRC/$DOTNET_TOOL/DotnetTool.csproj" \
53+
/p:Configuration="$CONFIGURATION" \
54+
/p:PackageVersion="$VERSION" \
55+
/p:PublishDir="$PACKAGE_ROOT/"
56+
else
57+
dotnet pack "$SRC/$DOTNET_TOOL/DotnetTool.csproj" \
58+
/p:Configuration="$CONFIGURATION" \
59+
/p:PackageVersion="$VERSION" \
60+
/p:PublishDir="$PACKAGE_ROOT/" \
61+
--output "$OUTPUT"
62+
fi
5163

5264
echo "Dotnet tool pack complete."

0 commit comments

Comments
 (0)