@@ -155,16 +155,23 @@ jobs:
155155 process.exit(1);
156156 }
157157
158- // Reconstruct: ONLY the key line (second line)
159- // We are removing the "untrusted comment: ..." line entirely
160- // because minisign/tauri seems to choke on it in this environment
161- const cleanContent = lines[1].trim();
158+ // Reconstruct: Comment + LF + Key
159+ // It seems minisign STRICTLY requires the comment line to identify the key type.
160+ // The previous error "invalid utf-8 sequence" when we removed the comment confirms
161+ // that it tried to parse the raw key bytes as a text header and failed.
162+
163+ // So we MUST include the comment. The problem is likely the newline encoding.
164+ // Let's try to be extremely explicit with Buffer concatenation to avoid string encoding issues.
165+
166+ const line1 = Buffer.from(lines[0].trim() + '\n', 'utf-8');
167+ const line2 = Buffer.from(lines[1].trim(), 'utf-8');
168+ const finalBuffer = Buffer.concat([line1, line2]);
162169
163170 const keyPath = path.resolve('private.key');
164- fs.writeFileSync(keyPath, cleanContent );
171+ fs.writeFileSync(keyPath, finalBuffer );
165172
166173 console.log('Private key written to: ' + keyPath);
167- console.log('Key length: ' + cleanContent .length);
174+ console.log('Key length: ' + finalBuffer .length);
168175
169176 fs.appendFileSync(process.env.GITHUB_OUTPUT, `key_path=${keyPath}\n`);
170177 env :
0 commit comments