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-prCreate these files in the flathub directory:
- a metainfo file generated with the AppStream web form, like
com.pears.HelloPear.metainfo.xml - a Flatpak YAML manifest, like
com.pears.HelloPear.yml
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.BuilderIn 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.HelloPearRepeat 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.HelloPearUninstall using:
flatpak uninstall com.pears.HelloPear
rm -rf ~/.var/app/com.pears.HelloPearIf the builds take up too much disk space, clear the build files from the flatpak directory:
rm -rf builddir repo .flatpak-builderSubmit for review
After confirming that the Flatpak works:
- Upload the Flatpak artifacts to a publicly accessible location with versioned URLs, like this site, and update the artifact links in the Flatpak YAML.
- For verification, upload an empty file to your app website at
https://<app-website>/.well-known/org.flathub.VerifiedApps.txt. - Open a PR on the flathub repository from your branch, like this PR, and address the review comments.
- Comment
bot, buildto test building the Flatpak on the Flathub CI. - Once the submission is accepted, the Flathub maintainers create a repository in the flathub organization from your submission branch, like this repository.
- 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. - 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, retryor 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.gzSnap
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 --autoIn 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 --devmodeAfter 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:
hellopearUninstall using:
snap remove hellopearIf the builds take up too much disk space, clean the build container:
cd out
snapcraft cleanRefer to the Electron Forge Snap Maker documentation to configure the Snap.
Publish to the Snap Store
After confirming that the Snap works:
- Create your developer account at login.ubuntu.com and log in.
- Log in from your terminal with
snapcraft login. - Register your Snap using the name with
snapcraft register <snap-name>, orsnapcraft register --private <snap-name>for a private Snap. - Publish with
snapcraft upload --release=stable <my-snap>.snap. - 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 stableSee also
- Build desktop distributables—produce the Linux artifacts these store flows package.
- Deploy your application—the peer-to-peer release flow that store installs update through.
- Distribute as a binary—direct binary distribution without a store.
- Pear OTA—how store-installed apps keep updating over the air.