stretchly icon indicating copy to clipboard operation
stretchly copied to clipboard

Support for Flatpak and perhaps Snap?

Open sjoerdschouten opened this issue 4 years ago • 15 comments

Hi there,

Would it be possible to ship Stretchly as a Flatpak (or potentially a Snap package)? The tool would become available for almost any distribution and it would greatly simplify maintaining it since updates are received automatically.

Looking forward hearing from you.

sjoerdschouten avatar Sep 20 '20 09:09 sjoerdschouten

There's an issue opened for Snap support: https://github.com/hovancik/stretchly/issues/525. I could not get it working due to some Electron errors.

I am using electron-builder to make releases, Flatpak is not supported, yet: https://github.com/electron-userland/electron-builder/issues/512

hovancik avatar Sep 20 '20 09:09 hovancik

So I published in SnapStore, I guess. I don't really agree with all that snap things so I am not a user and can't test :)

hovancik avatar Oct 03 '20 08:10 hovancik

Yay, seems like they have merged support to build flatpaks, will have to check that https://github.com/electron-userland/electron-builder/pull/5711

hovancik avatar Apr 24 '21 18:04 hovancik

I've started working on this in PR #1013, but seeing as a few decisions should be hashed out here according to the CONTRIBUTING.md, it's just a proof-of-concept at the moment.

Flatpak support will require a .desktop file, an AppStream metadata file for displaying app info in app stores, and a Flatpak manifest. In the case of the manifest, projects often include one with their source code that tracks the latest changes in the repository and allows building locally while they also have a manifest on Flathub for releases. Getting the app on Flathub is done by submitting a PR against flathub/flathub containing a Flatpak manifest. App maintainers should submit this PR because they will be granted write access to the repository that will be created on Flathub for their application. The submission process is described here and requirements here.

  1. So, first question, is there a directory in the project where I should put these three files?
  2. When / where should the .desktop file and AppStream metadata file be validated? It'd be easy to do this in GitHub actions, but this probably only needs to be run before a release as any issues could block updating the release version on Flathub.
  3. How should Stretchly handle automatic updates from within the Flatpak? Since users will get automatic updates from Flathub, this is managed outside of Stretchly. Any changes to the installed version of Stretchly will likely get overwritten when the Flatpak is updated. Perhaps the option for automatic updates should just be turned off by default for the Flatpak?
  4. Where is the best place to document the process for building and updating the Flatpak using the local development manifest?
  5. The AppStream metadata contains release information for the app, so it needs to be updated for each new release. What's the best way to make sure this happens each release?

I think that covers most of the major design decisions. My proof-of-concept seems to be working quite well except for the app indicator which is usable but only displays a ... instead of the Stretchly icon.

@hovancik

jwillikers avatar Aug 09 '21 12:08 jwillikers

And here's a nice preview of how the AppStream metadata file from the PR presents Stretchly in GNOME Software.

Stretchly in Software Store

jwillikers avatar Aug 09 '21 13:08 jwillikers

Hi @jwillikers , I am holidaying a lot these days, but did you use https://github.com/electron-userland/electron-builder/pull/5711 or something else? Not sure how it works, but I was planning to use that. I am building Stretchly builds using electron-builder on CI so keep doing that would be best

hovancik avatar Aug 12 '21 09:08 hovancik

@hovancik Sorry, I thought you we're linking to the official Flatpak documentation which added a section on Electron, but the support in electron-builder looks great! I'll see what I can do to make that happen. It doesn't really solve the problem of publishing to Flathub, though. If you want to publish to Flathub, they actually take care of all the CI and build your app from sources using a Flatpak manifest you submit to them. Your app even gets a dedicated repository under their organization for this. GNOME Podcasts Flathub repo is a simple example.

Anyways, enjoy your holidays and there's of course no rush to get back to me!

jwillikers avatar Aug 12 '21 12:08 jwillikers

I guess it might be similar to Snap? I had to register on snap web and add my project there. Then I am building package on CI and manually publish/push to their server via docker container that has all the needed stuff. https://github.com/hovancik/stretchly/blob/trunk/publish-snap.md

hovancik avatar Aug 19 '21 07:08 hovancik

I guess it might be similar to Snap? I had to register on snap web and add my project there. Then I am building package on CI and manually publish/push to their server via docker container that has all the needed stuff. https://github.com/hovancik/stretchly/blob/trunk/publish-snap.md

It's a little bit different from Snap in that Flathub's CI infrastructure will build your Flatpak for you. It's not actually necessary for you to build anything locally and they don't allow you to submit binaries. Flathub uses what Flatpak calls a manifest file, which describes how to build and package your app in a declarative syntax. They then build your application and package it up from those instructions on their nodes. They act like a bit of a trusted source since you know the binaries weren't tampered with since they built them.

The manifest Flathub uses to build your app will get it's own GitHub repository under their organization after you submit a pull-request to flathub/flathub for your app. You'll be given write permissions to the repository and will need to update it accordingly when you release new versions of Stretchly.

jwillikers avatar Aug 19 '21 12:08 jwillikers

Any updates on Flatpak support?

12people avatar Nov 22 '21 16:11 12people

@12people Well, there's still a concerning bug where the background color is always bright white instead of the selected color. I haven't updated the Flatpak branch in a while, so I'll need to update that. The main thing that I need to do is convert my current Flatpak manifest to the Electron Builder configuration, which should be pretty straight-forward. We can address Flathub publication after that is finished. I haven't gotten around to this, but I also wasn't aware there was still so much interest. I'll likely have time to move this forward this weekend, but if I'm busy due to the holidays I should get to it the following weekend.

jwillikers avatar Nov 23 '21 00:11 jwillikers

I've started new job in September and was superbusy so no progress on Stretchly since then. I've made new release to publish older changes and now I am pretty much starting to look at all of the issues since few months ago :(

hovancik avatar Nov 24 '21 09:11 hovancik

I've managed to at least update everything to the latest version in my Flatpak branch and ensure I can still built the Flatpak using flatpak-builder.

I've started getting things to build with Electron-Builder. It seems to crash pretty quickly once it reaches the step where it runs flatpak-builder. Of course, there's barely an error message why the call to flatpak-builder fails. I'll have to do more digging when I get time. Any help is appreciated and I've updated the build-flatpak.md file in my branch with instructions for building with Electron Builder if anyone wants to try.

jwillikers avatar Dec 04 '21 20:12 jwillikers

Oh, that's fantastic. I just realized that the updated Flatpak built directly with flatpak-builder now uses the proper background color instead of a painfully bright white screen.

jwillikers avatar Dec 04 '21 20:12 jwillikers

Would be good if some flatpak user could try. Seems like electron-builder is not working well with it: https://github.com/electron-userland/electron-builder/issues/6211

hovancik avatar Dec 11 '21 19:12 hovancik

@12people @sjoerdschouten Stretchly is now live on Flathub! https://flathub.org/apps/details/net.hovancik.Stretchly

jwillikers avatar Sep 29 '22 13:09 jwillikers

Many thanks @jwillikers ! :)

hovancik avatar Sep 29 '22 13:09 hovancik