How to package an Electron app as snap from an monorepo

Is it possible to package an Electron app as an snap from an monorepo (e.g.: https://github.com/benawad/dogehouse/tree/new-design/baklava)? I’m currently planning how to build that into multiarch snap without requesting Snapcraft Support for adding additional channel stuff and publish each snap arch separately.

There isn’t any support for multiple snaps in a single repo for the “build from Github master” automation found in the dashboard on https://snapcraft.io. That isn’t the only way you can build a snap though.

If you only care about x86, one option would be to set up one or more Github Actions workflows to build your snaps using the snapcore/action-build and snapcore/action-publish actions. The build action can invoke snapcraft from a subdirectory to build only part of your tree, if that’s what you need. You can also run whatever scripts you need before performing the build, if its necessary to adjust your source tree for each build.

Building on other platforms is a bit trickier, but you might have luck with @lucyllewy’s multiarch Snapcraft build action described here:

It essentially uses qemu-user to emulate the user-space ISA and kernel interface of other architectures, so it looks like your snap is being built natively on each chosen architecture. Provided you don’t hit any bug’s in qemu-user’s emulation, this should be mostly seamless.

2 Likes