LogoPear Docs
How ToRelease & distribute your appBuild & package

Submit to app stores

Package a Pear Electron desktop app for Flathub and the Snap Store—prepare the manifests, test the packages locally, and publish releases for review.

Applications built from the hello-pear-electron template can also be distributed through platform-specific application stores. This guide covers the two Linux store flows the template supports: Flathub (Flatpak) and the Snap Store.

Both flows start from the Linux distributables produced by npm run make—see Build desktop distributables first. Store distribution complements, rather than replaces, peer-to-peer distribution: apps installed from a store still update over the air through Pear OTA.

Flathub

Flathub packages applications as Flatpaks. This section covers preparing a Flatpak manifest and submitting releases for review.

Prepare the submission

Fork the flathub repository in your GitHub organization, clone it, and create a branch targeting the repository's new-pr branch:

git clone git@github.com:<org>/flathub.git
cd flathub
git checkout -b my-app-submission -t new-pr

Create these files in the flathub directory:

Test the Flatpak locally

Install the Flatpak tools:

sudo apt install flatpak
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub org.flatpak.Builder

In the project directory, build the app for Linux and serve the generated Flatpak artifacts over HTTP:

python3 -m http.server --directory out/make/

In the flatpak directory, build and install the Flatpak:

flatpak run --command=flathub-build org.flatpak.Builder --disable-rofiles-fuse com.pears.HelloPear.yml
flatpak install --user ./repo com.pears.HelloPear

Repeat the build command after making any changes to the manifest.

Launch the application from your desktop environment or run it from the CLI:

flatpak run com.pears.HelloPear

Uninstall using:

flatpak uninstall com.pears.HelloPear
rm -rf ~/.var/app/com.pears.HelloPear

If the builds take up too much disk space, clear the build files from the flatpak directory:

rm -rf builddir repo .flatpak-builder

Submit for review

After confirming that the Flatpak works:

  1. Upload the Flatpak artifacts to a publicly accessible location with versioned URLs, like this site, and update the artifact links in the Flatpak YAML.
  2. For verification, upload an empty file to your app website at https://<app-website>/.well-known/org.flathub.VerifiedApps.txt.
  3. Open a PR on the flathub repository from your branch, like this PR, and address the review comments.
  4. Comment bot, build to test building the Flatpak on the Flathub CI.
  5. Once the submission is accepted, the Flathub maintainers create a repository in the flathub organization from your submission branch, like this repository.
  6. Log in to the Flathub Developer Portal to manage the app, and complete verification by copying the token from that page to https://<app-website>/.well-known/org.flathub.VerifiedApps.txt.
  7. In a few hours the app should be available on Flathub, like this app.

If the app doesn't show up on Flathub:

  • If the Flathub bot opens an issue on the repository containing build errors, address it.
  • If it's unrelated, comment bot, retry or open an issue in Flathub for assistance from the maintainers.
  • Follow the build status at builds.flathub.org; app-specific status is at https://builds.flathub.org/status/<app-id>.

Automate new releases

To have the Flathub bot open PRs when new versions of the app are available on your website, follow the external data checker guide and configure it on the type: archive source, matching the format of your download site:

x-checker-data:
  type: html
  url: https://static.keet.io/downloads/
  version-pattern: href="((?:\d+\.)+\d+)/"
  url-template: https://static.keet.io/downloads/$version/Keet-arm64-flatpak.tar.gz

Snap

Snap packages applications for Linux and distributes them through the Snap Store. This section covers preparing a Snap package, testing it locally, and publishing releases.

Build and test the Snap

Install the Snap tools:

snap install snapcraft --classic
snap install lxd
sudo usermod -a -G lxd $USER
sudo lxd init --auto

In the project directory, build the app for Linux—this creates a .snap package in the out/make directory. Install it:

snap install out/make/hellopear_1.0.0_arm64.snap --devmode

After making changes to the Snap configuration, rebuild the application and reinstall the generated Snap.

Launch the application from your desktop environment or run it from the CLI:

hellopear

Uninstall using:

snap remove hellopear

If the builds take up too much disk space, clean the build container:

cd out
snapcraft clean

Refer to the Electron Forge Snap Maker documentation to configure the Snap.

Publish to the Snap Store

After confirming that the Snap works:

  1. Create your developer account at login.ubuntu.com and log in.
  2. Log in from your terminal with snapcraft login.
  3. Register your Snap using the name with snapcraft register <snap-name>, or snapcraft register --private <snap-name> for a private Snap.
  4. Publish with snapcraft upload --release=stable <my-snap>.snap.
  5. Check the release status with snapcraft status <snap-name>.

Snapcraft will guide you with the next steps if a release fails. Once released, the Snap is available on the Snap Store at https://snapcraft.io/<snap-name>:

snap install <snap-name>
<snap-name>

Automate Snap releases

To publish from CI, first create a credentials file:

snapcraft export-login <credentials-filename>

Set the contents of the file as a secret in your automation pipeline and authenticate Snap with:

export SNAPCRAFT_STORE_CREDENTIALS=$(cat <credentials-filename>)

Upload a new Snap release to the desired channel (for example, stable):

snapcraft upload <snap-name>.snap --release stable

See also

On this page