@@ -133,6 +133,54 @@ runs:
133133 with :
134134 setup_exe_source : ${{ inputs.setup_exe_source }}
135135
136+ - name : Stamp icon into Velopack setup template
137+ if : ${{ inputs.installer_type == 'velopack' && inputs.velopack_icon != '' }}
138+ shell : bash
139+ env :
140+ ICON : ${{ inputs.velopack_icon }}
141+ run : |
142+ set -x
143+ if [[ ! -f ".app/$ICON" ]]; then
144+ echo "Icon not found at .app/$ICON, skipping template icon stamp"
145+ exit 0
146+ fi
147+
148+ # Find the vpk vendor setup.exe template
149+ VPK_STORE=""
150+ for candidate in \
151+ "$HOME/.dotnet/tools/.store/vpk" \
152+ "$USERPROFILE/.dotnet/tools/.store/vpk" \
153+ "$(cygpath "$USERPROFILE" 2>/dev/null)/.dotnet/tools/.store/vpk"
154+ do
155+ if [[ -d "$candidate" ]]; then
156+ VPK_STORE="$candidate"
157+ break
158+ fi
159+ done
160+
161+ if [[ -z "$VPK_STORE" ]]; then
162+ echo "::warning::vpk tool store not found, skipping template icon stamp"
163+ exit 0
164+ fi
165+
166+ TEMPLATE_SETUP="$(find "$VPK_STORE" -iname 'setup.exe' -type f | head -n 1)"
167+ if [[ -z "$TEMPLATE_SETUP" ]]; then
168+ echo "::warning::setup.exe template not found in vpk store, skipping icon stamp"
169+ exit 0
170+ fi
171+ echo "Found setup.exe template at: $TEMPLATE_SETUP"
172+
173+ # Download rcedit and stamp the icon into the template PE resources.
174+ # vpk's --icon flag bundles the .ico inside the archive but does not
175+ # update the PE RT_ICON resources when --signTemplate is used, so
176+ # Windows Explorer shows a generic icon instead of the app icon.
177+ # By stamping the template before vpk pack, the final Setup.exe
178+ # inherits the correct icon and vpk signs the result normally.
179+ rcedit_url="https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe"
180+ curl -L -f -o rcedit.exe "$rcedit_url"
181+ ./rcedit.exe "$TEMPLATE_SETUP" --set-icon ".app/$ICON"
182+ echo "Stamped icon into setup.exe template"
183+
136184 - name : Build and sign Velopack package
137185 if : ${{ inputs.installer_type == 'velopack' }}
138186 shell : bash
0 commit comments