mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.04k stars 49 forks source link

Snap on the snap store #7

Closed alanzanattadev closed 5 years ago

alanzanattadev commented 5 years ago

Hi,

Can you post the snap on the snap store, so that we have automatic updates ?

Please, asking for a friend ;)

Best Regards

mb21 commented 5 years ago

You should get automatic updates as is.

I'm using the Electron builder updater's checkForUpdatesAndNotify() for that, which pulls the new release directly from GitHub. Let me know if there are issues with that. But it makes it very easy for me to draft a new release, without having to upload packages to all the different app stores that are out there nowadays...

alanzanattadev commented 5 years ago

You can setup an automated upload of the snap on GitHub on each release, because I think the auto update is disabled in Electron in snaps.

evandandrea commented 5 years ago

@mb21 snaps are read-only (but have writeable dirs in $SNAP_USER_DATA and $SNAP_USER_COMMON), so updating in place won't work. If manually publishing is a hassle, what do you think of using Travis to automatically publish into the Snap Store on release tags?

(I'm part of the Snapcraft team, for what it's worth)

mb21 commented 5 years ago

Sure, I just haven't had time for this. Pull requests welcome! Or do I need to first setup Travis for this github repo? Have also heard that CircleCI might be a better choice?

evandandrea commented 5 years ago

Awesome! If you can enable Travis for the repo and set the SNAP_TOKEN environment variable (you'll need an account, the panwriter name registered, and snapcraft installed via brew or snap), I can put together a PR that adds the .travis.yml.

evandandrea commented 5 years ago

Sure, we could follow these instructions for Circle

mb21 commented 5 years ago

Cool, yeah I've a better feeling about CircleCI, if it's not too much trouble...

I've registered the panwriter name... and added the github project to CircleCI. Not sure yet where to find the SNAP_TOKEN in the snapcraft GUI... will look again later...

evandandrea commented 5 years ago

Cool. You get the snap token via the snapcraft command (it's in brew on Mac and apt or snap on Linux). If you snapcraft login with the account you just created, you can:

snapcraft export-login snapcraft.login
base64 snapcraft.login

Copy that to the clipboard, then put it into a private environment variable on Circle CI (in Build > Project > Settings) called "SNAPCRAFT_LOGIN_FILE".

More detail here: https://circleci.com/docs/2.0/build-publish-snap-packages/#publishing

mb21 commented 5 years ago

Okay, thanks. Do I need to do this on the same computer where I code-sign the panwriter builds? (I'm not on that computer at the moment...) Or why exactly do I need to use the commandline-program instead of the web interface?

evandandrea commented 5 years ago

It just has to be on a computer you're comfortable to log into your account from. If you don't want that computer to be able to manage snaps after you've exported the login token for Circle CI, you can delete the ~/.config/snapcraft directory.

I've filed a bug for being able to grab the login token from the web UI in the future: https://github.com/canonical-websites/snapcraft.io/issues/1685

mb21 commented 5 years ago

I see, thanks. I've added the env variable, so all we need is the config file in the repo now I guess?

evandandrea commented 5 years ago

Yes, I'll work on that PR now (unless you're already on it)

mb21 commented 5 years ago

Sure, that would be great!

evandandrea commented 5 years ago

Sorry for not getting this done yesterday. I've put together a PR in https://github.com/mb21/panwriter/pull/10. It should work. I've tested the snap creation, but I cannot test the Circle CI parts.

mb21 commented 5 years ago

No hurry! Thanks, I'll try it later today...

evandandrea commented 5 years ago

Cheers :)

mb21 commented 5 years ago

Hm... not quite there yet: https://circleci.com/gh/mb21/panwriter/2 It tries to build the Windows version as well..

mb21 commented 5 years ago

Fixed that... but now I'll have to add the GH_TOKEN var.. which is again on my other machine...

evandandrea commented 5 years ago

I don't think we need GH_TOKEN. It looks like electron-builder is trying to publish the assets to GitHub, but if we're just pushing to the Snap Store for now we can append --publish=never to the npm run dist -- -l

mb21 commented 5 years ago

Ah right, thanks for your help! It appears to be up in the store:

https://snapcraft.io/panwriter

Let me know how it's working!