Skip to content

Commit 7047f48

Browse files
authored
Merge pull request #905 from mjcheetham/pkgicon
Add icon to dotnet tool NuGet package
2 parents 74b3d6a + bdb3a9a commit 7047f48

File tree

6 files changed

+55
-50
lines changed

6 files changed

+55
-50
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,11 @@ jobs:
620620

621621
- name: Package tool
622622
run: |
623-
src/shared/DotnetTool/pack-tool.sh
623+
src/shared/DotnetTool/pack-tool.sh \
624+
--version=$GitBuildVersionSimple \
625+
--configuration=Release
624626
625627
- name: Publish tool
626628
run: |
627-
dotnet nuget push ./out/nupkg/*.nupkg \
629+
dotnet nuget push ./out/shared/DotnetTool/nupkg/Release/*.nupkg \
628630
--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: 45 additions & 44 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
@@ -38,7 +37,7 @@ esac
3837
done
3938

4039
if [ -z "$VERSION" ]; then
41-
VERSION="$GitBuildVersionSimple"
40+
die "--version was not set"
4241
fi
4342

4443
# Directories
@@ -47,42 +46,32 @@ ROOT="$( cd "$THISDIR"/../../.. ; pwd -P )"
4746
SRC="$ROOT/src"
4847
OUT="$ROOT/out"
4948
GCM_SRC="$SRC/shared/Git-Credential-Manager"
49+
GCM_UI_SRC="$SRC/shared/Git-Credential-Manager.UI.Avalonia"
5050
BITBUCKET_UI_SRC="$SRC/shared/Atlassian.Bitbucket.UI.Avalonia"
5151
GITHUB_UI_SRC="$SRC/shared/GitHub.UI.Avalonia"
5252
GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
5353
DOTNET_TOOL="shared/DotnetTool"
5454
PROJ_OUT="$OUT/$DOTNET_TOOL"
5555

56-
PACKAGE="$ROOT/nuget"
57-
CONFIGURATION="${CONFIGURATION:=Release}"
56+
CONFIGURATION="${CONFIGURATION:=Debug}"
5857

5958
# Build parameters
6059
FRAMEWORK=net6.0
6160

6261
# 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"
62+
OUTDIR="$PROJ_OUT/nupkg/$CONFIGURATION"
63+
IMGOUT="$OUTDIR/images"
64+
PAYLOAD="$OUTDIR/payload"
65+
SYMBOLOUT="$OUTDIR/payload.sym"
66+
67+
# Cleanup output directory
68+
if [ -d "$OUTDIR" ]; then
69+
echo "Cleaning existing output directory '$OUTDIR'..."
70+
rm -rf "$OUTDIR"
8271
fi
8372

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

8776
if [ -z "$DOTNET_ROOT" ]; then
8877
DOTNET_ROOT="$(dirname $(which dotnet))"
@@ -91,49 +80,61 @@ fi
9180
# Publish core application executables
9281
echo "Publishing core application..."
9382
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
94-
--configuration="$CONFIGURATION" \
95-
--framework="$FRAMEWORK" \
96-
--output="$(make_absolute "$PAYLOAD")" \
83+
--configuration="$CONFIGURATION" \
84+
--framework="$FRAMEWORK" \
85+
--output="$(make_absolute "$PAYLOAD")" \
86+
-p:UseAppHost=false || exit 1
87+
88+
echo "Publishing core UI helper..."
89+
$DOTNET_ROOT/dotnet publish "$GCM_UI_SRC" \
90+
--configuration="$CONFIGURATION" \
91+
--framework="$FRAMEWORK" \
92+
--output="$(make_absolute "$PAYLOAD")" \
9793
-p:UseAppHost=false || exit 1
9894

9995
echo "Publishing Bitbucket UI helper..."
10096
$DOTNET_ROOT/dotnet publish "$BITBUCKET_UI_SRC" \
101-
--configuration="$CONFIGURATION" \
102-
--framework="$FRAMEWORK" \
103-
--output="$(make_absolute "$PAYLOAD")" \
97+
--configuration="$CONFIGURATION" \
98+
--framework="$FRAMEWORK" \
99+
--output="$(make_absolute "$PAYLOAD")" \
104100
-p:UseAppHost=false || exit 1
105101

106102
echo "Publishing GitHub UI helper..."
107103
$DOTNET_ROOT/dotnet publish "$GITHUB_UI_SRC" \
108-
--configuration="$CONFIGURATION" \
109-
--framework="$FRAMEWORK" \
110-
--output="$(make_absolute "$PAYLOAD")" \
104+
--configuration="$CONFIGURATION" \
105+
--framework="$FRAMEWORK" \
106+
--output="$(make_absolute "$PAYLOAD")" \
111107
-p:UseAppHost=false || exit 1
112108

113109
echo "Publishing GitLab UI helper..."
114110
$DOTNET_ROOT/dotnet publish "$GITLAB_UI_SRC" \
115-
--configuration="$CONFIGURATION" \
116-
--framework="$FRAMEWORK" \
117-
--output="$(make_absolute "$PAYLOAD")" \
111+
--configuration="$CONFIGURATION" \
112+
--framework="$FRAMEWORK" \
113+
--output="$(make_absolute "$PAYLOAD")" \
118114
-p:UseAppHost=false || exit 1
119115

120116
# Collect symbols
121117
echo "Collecting managed symbols..."
122118
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1
123119

120+
# Copy DotnetToolSettings.xml file
121+
echo "Copying out package configuration files..."
122+
cp "$SRC/$DOTNET_TOOL/DotnetToolSettings.xml" "$PAYLOAD/"
123+
124+
# Copy package icon image
125+
echo "Copying images..."
126+
cp "$SRC/$DOTNET_TOOL/icon.png" "$IMGOUT" || exit 1
127+
124128
echo "Build complete."
125129

126130
#####################################################################
127131
# Pack dotnet tool
128132
#####################################################################
129133
echo "Creating dotnet tool package..."
130134

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/"
135+
dotnet pack "$SRC/$DOTNET_TOOL/DotnetTool.csproj" \
136+
/p:Configuration="$CONFIGURATION" \
137+
/p:PackageVersion="$VERSION" \
138+
/p:PublishDir="$OUTDIR/"
138139

139140
echo "Dotnet tool pack complete."

src/windows/Installer.Windows/layout.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ dotnet publish "$GCM_SRC" `
4848

4949
Write-Output "Publishing core UI helper..."
5050
dotnet publish "$GCM_UI_SRC" `
51-
--framework net472 `
5251
--configuration "$CONFIGURATION" `
53-
--runtime win-x86 `
5452
--output "$PAYLOAD"
5553

5654
Write-Output "Publishing Bitbucket UI helper..."

0 commit comments

Comments
 (0)