Skip to content

Commit 65d2d88

Browse files
committed
dotnet-tool: add GCM icon to tool nuget package
Add the GCM icon to the NuGet package used for the dotnet tool. The image is copied to the root of the package under a new `images` directory (/images). The tool payload continues to be copied under the required `/tool/net6.0/any` directory. Modify the pack-tool.sh script to keep all build output under the /out directory of the repository (which is in .gitignore). Output from running pack-tool.sh now looks like this: . └── out └── shared └── DotnetTool └── nupkg └── Debug ├── git-credential-manager.$VERSION.nupkg ├── images # icon ├── payload # dotnet publish output └── payload.sym # pdbs The contents of the NuGet package looks like this: . ├── [Content_Types].xml ├── _rels ├── git-credential-manager.nuspec ├── images │   └── icon.png # copied from the output images/ dir ├── package │   └── services │   └── metadata/... └── tools └── net6.0 └── any/... # copied from the output payload/ dir
1 parent 7e2b209 commit 65d2d88

File tree

5 files changed

+42
-45
lines changed

5 files changed

+42
-45
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,5 +626,5 @@ jobs:
626626
627627
- name: Publish tool
628628
run: |
629-
dotnet nuget push ./out/nupkg/*.nupkg \
629+
dotnet nuget push ./out/shared/DotnetTool/nupkg/Release/*.nupkg \
630630
--api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

src/shared/DotnetTool/DotnetTool.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
publishDir=$(PublishDir);
1010
</NuspecProperties>
1111
<NoBuild>true</NoBuild>
12-
<OutputPath>../../../out/nupkg</OutputPath>
12+
<OutputPath>$(ProjectOutPath)nupkg\$(Configuration)\</OutputPath>
13+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1314
</PropertyGroup>
1415
</Project>

src/shared/DotnetTool/dotnet-tool.nuspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
<version>$version$</version>
66
<description>Secure, cross-platform Git credential storage with authentication to Azure Repos, GitHub, and other popular Git hosting services.</description>
77
<authors>git-credential-manager</authors>
8+
<icon>images\icon.png</icon>
9+
<iconUrl>https://raw.githubusercontent.com/GitCredentialManager/git-credential-manager/main/assets/gcm-transparent.png</iconUrl>
810
<packageTypes>
911
<packageType name="DotnetTool" />
1012
</packageTypes>
1113
</metadata>
1214
<files>
13-
<file src="$publishdir$" target="tools/net6.0/any" />
15+
<file src="$publishdir$payload/" target="tools/net6.0/any" />
16+
<file src="$publishdir$images/icon.png" target="images" />
1417
</files>
1518
</package>

src/shared/DotnetTool/icon.png

6.92 KB
Loading

src/shared/DotnetTool/pack-tool.sh

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ make_absolute () {
1818
#####################################################################
1919
# Lay out
2020
#####################################################################
21-
echo "Laying out files for dotnet tool..."
2221
# Parse script arguments
2322
for i in "$@"
2423
do
@@ -53,36 +52,25 @@ GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
5352
DOTNET_TOOL="shared/DotnetTool"
5453
PROJ_OUT="$OUT/$DOTNET_TOOL"
5554

56-
PACKAGE="$ROOT/nuget"
5755
CONFIGURATION="${CONFIGURATION:=Debug}"
5856

5957
# Build parameters
6058
FRAMEWORK=net6.0
6159

6260
# Outputs
63-
PAYLOAD="$PROJ_OUT/payload/$CONFIGURATION"
64-
SYMBOLOUT="$PROJ_OUT/payload.sym/$CONFIGURATION"
65-
66-
# Cleanup payload directory
67-
if [ -d "$PAYLOAD" ]; then
68-
echo "Cleaning existing payload directory '$PAYLOAD'..."
69-
rm -rf "$PAYLOAD"
70-
fi
71-
72-
# Cleanup symbol directory
73-
if [ -d "$SYMBOLOUT" ]; then
74-
echo "Cleaning existing symbols directory '$SYMBOLOUT'..."
75-
rm -rf "$SYMBOLOUT"
76-
fi
77-
78-
# Cleanup package directory
79-
if [ -d "$PACKAGE" ]; then
80-
echo "Cleaning existing package directory '$PACKAGE'..."
81-
rm -rf "$PACKAGE"
61+
OUTDIR="$PROJ_OUT/nupkg/$CONFIGURATION"
62+
IMGOUT="$OUTDIR/images"
63+
PAYLOAD="$OUTDIR/payload"
64+
SYMBOLOUT="$OUTDIR/payload.sym"
65+
66+
# Cleanup output directory
67+
if [ -d "$OUTDIR" ]; then
68+
echo "Cleaning existing output directory '$OUTDIR'..."
69+
rm -rf "$OUTDIR"
8270
fi
8371

84-
# Ensure directories exist
85-
mkdir -p "$PAYLOAD" "$SYMBOLOUT" "$PACKAGE"
72+
# Ensure output directories exist
73+
mkdir -p "$PAYLOAD" "$SYMBOLOUT" "$IMGOUT"
8674

8775
if [ -z "$DOTNET_ROOT" ]; then
8876
DOTNET_ROOT="$(dirname $(which dotnet))"
@@ -91,49 +79,54 @@ fi
9179
# Publish core application executables
9280
echo "Publishing core application..."
9381
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
94-
--configuration="$CONFIGURATION" \
95-
--framework="$FRAMEWORK" \
96-
--output="$(make_absolute "$PAYLOAD")" \
82+
--configuration="$CONFIGURATION" \
83+
--framework="$FRAMEWORK" \
84+
--output="$(make_absolute "$PAYLOAD")" \
9785
-p:UseAppHost=false || exit 1
9886

9987
echo "Publishing Bitbucket UI helper..."
10088
$DOTNET_ROOT/dotnet publish "$BITBUCKET_UI_SRC" \
101-
--configuration="$CONFIGURATION" \
102-
--framework="$FRAMEWORK" \
103-
--output="$(make_absolute "$PAYLOAD")" \
89+
--configuration="$CONFIGURATION" \
90+
--framework="$FRAMEWORK" \
91+
--output="$(make_absolute "$PAYLOAD")" \
10492
-p:UseAppHost=false || exit 1
10593

10694
echo "Publishing GitHub UI helper..."
10795
$DOTNET_ROOT/dotnet publish "$GITHUB_UI_SRC" \
108-
--configuration="$CONFIGURATION" \
109-
--framework="$FRAMEWORK" \
110-
--output="$(make_absolute "$PAYLOAD")" \
96+
--configuration="$CONFIGURATION" \
97+
--framework="$FRAMEWORK" \
98+
--output="$(make_absolute "$PAYLOAD")" \
11199
-p:UseAppHost=false || exit 1
112100

113101
echo "Publishing GitLab UI helper..."
114102
$DOTNET_ROOT/dotnet publish "$GITLAB_UI_SRC" \
115-
--configuration="$CONFIGURATION" \
116-
--framework="$FRAMEWORK" \
117-
--output="$(make_absolute "$PAYLOAD")" \
103+
--configuration="$CONFIGURATION" \
104+
--framework="$FRAMEWORK" \
105+
--output="$(make_absolute "$PAYLOAD")" \
118106
-p:UseAppHost=false || exit 1
119107

120108
# Collect symbols
121109
echo "Collecting managed symbols..."
122110
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1
123111

112+
# Copy DotnetToolSettings.xml file
113+
echo "Copying out package configuration files..."
114+
cp "$SRC/$DOTNET_TOOL/DotnetToolSettings.xml" "$PAYLOAD/"
115+
116+
# Copy package icon image
117+
echo "Copying images..."
118+
cp "$SRC/$DOTNET_TOOL/icon.png" "$IMGOUT" || exit 1
119+
124120
echo "Build complete."
125121

126122
#####################################################################
127123
# Pack dotnet tool
128124
#####################################################################
129125
echo "Creating dotnet tool package..."
130126

131-
mkdir -p "$PACKAGE" || exit 1
132-
echo "Laying out files..."
133-
cp -r "$SRC/$DOTNET_TOOL/DotnetToolSettings.xml" \
134-
"$PAYLOAD/." \
135-
"$PACKAGE/"
136-
137-
dotnet pack "$SRC/$DOTNET_TOOL/DotnetTool.csproj" /p:PackageVersion="$VERSION" /p:PublishDir="$PACKAGE/"
127+
dotnet pack "$SRC/$DOTNET_TOOL/DotnetTool.csproj" \
128+
/p:Configuration="$CONFIGURATION" \
129+
/p:PackageVersion="$VERSION" \
130+
/p:PublishDir="$OUTDIR/"
138131

139132
echo "Dotnet tool pack complete."

0 commit comments

Comments
 (0)