fix(release): a snap built in a clone of its own is packed inside it, then moved into the release's folder
All checks were successful
CI / check (push) Successful in 39m47s
CI / deploy (push) Successful in 59s

snapcraft packs nowhere outside the project it builds, so Todo 0.1.0's release stopped
after its snap was built ("Cannot create packages outside of the project tree").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-03 09:20:42 +01:00
commit 34001b1aff
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 37 additions and 1 deletions

View file

@ -215,4 +215,14 @@ final class const SnapRelease({
/// does for the root's, and outside the repository, which the checks would
/// otherwise analyse.
String projectPath(String home) => '$home/.cache/halkyon-release/snap/$name';
/// Where `snapcraft pack` writes the snap: the release's folder ([out] in
/// [root]) for the root's, its clone for any other, as snapcraft packs
/// nowhere outside the project it builds (found releasing Todo 0.1.0, 3 Nov
/// 2026); the release tool moves it into the release's folder from there.
String packPath({
required String home,
required String root,
required String out,
}) => atRoot ? '$root/$out' : projectPath(home);
}

View file

@ -454,11 +454,21 @@ final class Releaser({
'clean',
snap.part,
], workingDirectory: project);
final packed = snap.packPath(
home: Platform.environment['HOME'] ?? '',
root: root.path,
out: out,
);
await _run('snapcraft', [
'pack',
'--output',
p.join(root.path, out),
packed,
], workingDirectory: project);
if (!snap.atRoot) {
File(p.join(packed, snapFile))
..copySync(p.join(root.path, out, snapFile))
..deleteSync();
}
await _checkSnap(p.join(out, snapFile), version);
}