Skip to content

Commit 6c7a9c5

Browse files
EdgarTwiggEdgarTwigg
authored andcommitted
Script changes necessary for windows signing.
1 parent 2034173 commit 6c7a9c5

2 files changed

Lines changed: 31 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ jobs:
6767
run: find standalone/src-tauri/target/${{ matrix.target }}/release/bundle -type f | sort
6868
shell: bash
6969

70+
- name: Copy NSIS plugin for artifact upload (Windows)
71+
if: matrix.target == 'x86_64-pc-windows-msvc'
72+
run: |
73+
mkdir -p standalone/src-tauri/target/${{ matrix.target }}/release/nsis/x64/plugins
74+
cp "$LOCALAPPDATA/tauri/NSIS/Plugins/x86-unicode/additional/nsis_tauri_utils.dll" \
75+
standalone/src-tauri/target/${{ matrix.target }}/release/nsis/x64/plugins/
76+
shell: bash
77+
7078
- name: Upload artifacts
7179
uses: actions/upload-artifact@v4
7280
with:
@@ -86,6 +94,7 @@ jobs:
8694
standalone/src-tauri/target/${{ matrix.target }}/release/bundle/**/*.nsis.zip
8795
standalone/src-tauri/target/${{ matrix.target }}/release/bundle/**/*.nsis.zip.sig
8896
standalone/src-tauri/target/${{ matrix.target }}/release/bundle/nsis/**
97+
standalone/src-tauri/target/${{ matrix.target }}/release/nsis/**
8998
9099
build-vscode:
91100
name: Build VSCode Extension

scripts/sign-and-deploy.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ check_git_clean() {
127127

128128
find_nsis_script() {
129129
find "$WORK_DIR/standalone-win-x64" \
130-
\( -name "*.nsi" -o -name "*.nsh" \) \
130+
-name "installer.nsi" \
131131
-print \
132132
| head -1
133133
}
@@ -136,22 +136,31 @@ rebuild_windows_installer() {
136136
local signed_exe="$1"
137137
local installer_path="$2"
138138

139-
check_command makensis "Install NSIS (makensis) and re-download artifacts"
139+
check_command makensis "Install NSIS: brew install makensis"
140140

141141
local script_path
142142
script_path=$(find_nsis_script)
143-
[[ -n "$script_path" ]] || error "NSIS script not found in downloaded artifacts; include bundle/nsis staging files before rebuilding the installer."
143+
[[ -n "$script_path" ]] || error "NSIS script not found in downloaded artifacts; ensure release.yml uploads the nsis staging directory."
144144

145145
local script_dir
146146
script_dir="$(cd "$(dirname "$script_path")" && pwd)"
147-
local bundle_root
148-
bundle_root="$(cd "$script_dir/.." && pwd)"
149147

150-
local staged_exe
151-
staged_exe=$(find "$bundle_root" -name "MouseTerm.exe" -not -path "$signed_exe" | head -1)
152-
[[ -n "$staged_exe" ]] || error "Could not find staged MouseTerm.exe for NSIS rebuild"
153-
154-
cp "$signed_exe" "$staged_exe"
148+
# The .nsi contains absolute Windows paths that don't exist on macOS.
149+
# Patch MAINBINARYSRCPATH to point to the signed exe.
150+
local abs_signed_exe
151+
abs_signed_exe="$(cd "$(dirname "$signed_exe")" && pwd)/$(basename "$signed_exe")"
152+
sed -i '' "s|^!define MAINBINARYSRCPATH .*|!define MAINBINARYSRCPATH \"$abs_signed_exe\"|" "$script_path"
153+
154+
# Patch ADDITIONALPLUGINSPATH to point to the plugin bundled in artifacts.
155+
local plugin_dir
156+
plugin_dir=$(find "$WORK_DIR/standalone-win-x64" -name "nsis_tauri_utils.dll" -exec dirname {} \; | head -1)
157+
if [[ -n "$plugin_dir" ]]; then
158+
local abs_plugin_dir
159+
abs_plugin_dir="$(cd "$plugin_dir" && pwd)"
160+
sed -i '' "s|^!define ADDITIONALPLUGINSPATH .*|!define ADDITIONALPLUGINSPATH \"$abs_plugin_dir\"|" "$script_path"
161+
else
162+
warn "nsis_tauri_utils.dll not found in artifacts; makensis may fail"
163+
fi
155164

156165
local installer_name
157166
installer_name="$(basename "$installer_path")"
@@ -163,7 +172,9 @@ rebuild_windows_installer() {
163172
makensis -NOCD -X"OutFile $installer_name" "$(basename "$script_path")"
164173
)
165174

166-
[[ -f "$installer_path" ]] || error "NSIS rebuild did not produce $installer_path"
175+
local output_path="$script_dir/$installer_name"
176+
[[ -f "$output_path" ]] || error "NSIS rebuild did not produce $installer_name"
177+
mv "$output_path" "$installer_path"
167178
}
168179

169180
resolve_tag_sha() {

0 commit comments

Comments
 (0)