Releasing a desktop app for windows, mac and linux with github actions

Clement Levallois
3 min readJan 12, 2021

--

the JavaFX logo

The goal is to create a desktop app in 2021, that will provide basic but powerful data science jobs to non coders. Example: analyzing the sentiment on texts in a variety of languages with Umigon. The app should be:

  • available on mac, windows and linux
  • self-contained: no need for the user to have the correct java version installed — no java preinstall at all.
  • extensible by plugins which can be discovered by the app at run time. One plugin = one new type of data science job offered to the user!
  • with no classpath conflict issues between the app and the plugins, and between the plugins themselves

These three last points (“just works”, plugins, modularity, no classpath hell) was achieved thanks to Java’s modular systems introduced since Java 9. Nice, clean and it feels really magical to have an app that can evolve and grow, even after being installed on the user’s computer. I hope to blog about it.

For the release on mac, windows and linux, this is tricky. I don’t have a Mac, and you need a Mac to create a Mac app. At this stage I can just create a Windows app created on my local Windows PC. It just needs two lines of code, thanks to new tools introduced recently in Java (jpackage and jlink). So, how to package the mac version though? Several alternatives:

  • owning a Mac
  • accessing paying services for macOS and iOS remote builds such as CircleCI, MacStadium or MacinCloud.
  • or using CI / CD tools (like Jenkins)

Jakob Jenkov (of Jenkov tutorials’ fame) kindly suggested that Github Actions could offer mac builds. Drawing heavily on stryjek’s script available here, that is the solution I tried, and it worked (yey sentiment analysis for the crowds!)

an illustration of github actions

Github actions are very simple: you can trigger actions when you do a git push or any other git command. What actions?

  • launching a mac environment
  • then installing a JDK on it
  • then running jlink and jpackage in this virtual environment, which package the jars that are in the repo. This creates a mac installer (.dmg app)
  • then placing this dmg file on a new release page on Github
  • done!

The whole process takes 2 to 4 minutes.

Github actions are very powerful, and not that hard to learn. I had not tried them before and could run the mac build after one evening of fiddling. As it worked so well, I extended the Github action to run the Windows and the Linux build as well. Cherry on the pie, these builds run concurrently, so the build time is kept under 5 minutes:

The github action script is a yaml file you place in .github/workflow/my-github-action.yml at the root of your repo. I spent most of the evening struggling with yml indentation (never used yml before). Also, the linux release created a .deb installer with a filename that was a bit unexpected and broke subsequent steps, so I struggled a bit on this too.

The result of the build can be seen here (the app does work but is in a alpha release. Curious about it? Ask me!)

screenshot of the releases for windows, mac and linux available from github

Next step: asking friends and family to install these installers on their Mac and Linux computers, and see if the app works! [update: confirmed to work on Linux]

The yml file for the github action can be found here. If you have any question on it ping me on Twitter!

--

--

Clement Levallois
Clement Levallois

Written by Clement Levallois

PhD, social scientist & data visualization specialist @EMLyon. @Gephi support team. #OpenAccess promoter. #Java dev.

No responses yet