Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: github action for mac, windows, and linux releases #25

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

Christopher-Hayes
Copy link
Contributor

@Christopher-Hayes Christopher-Hayes commented Jun 5, 2022

Description

This creates a release.yml that runs a GitHub action when a tag (such as v1.3.3) is pushed to build releases for MacOS, Windows, and Linux.

MacOS: .dmg

Windows: .exe

Linux: .snap and .AppImage

Updated the README to provide useful info on how to install different releases. Might need to be split off into a separate Markdown file or shortened, since it's a little verbose.

Example Release on Fork

Here's an example of a release this action produced on my fork of this repo:

https://github.com/Christopher-Hayes/image-optimizer/releases/tag/v1.3.8

To produce that release, I ran this:

git add -A # Updated the version in the package.json
git commit -m "chore: new v1.3.8 release"
git tag v1.3.8
git push && git push --tags

When the GitHub Action finishes, it creates a "draft" release for the "v1.3.8" tag with all the release files, you'll just need to manually go to that release in GitHub and "publish" it.

Here are the details of that Action running: https://github.com/Christopher-Hayes/image-optimizer/actions/runs/2444457428

GitHub Action

Uses this electron-builder GH Action: https://github.com/samuelmeuli/action-electron-builder

That GitHub Action requires that yarn build does not run electron-builder, that it only builds the frontend. The GitHub Action separately runs the electron-builder. So, this PR needed to do some refactoring to meet that requirement:

GitHub Secrets

MacOS code-signing can be accomplished by adding the following GitHub secrets:

Required for MacOS development, so these GitHub secrets should be in place.

mac_certs The base64 encoded .p12 certificate.

mac_certs_password The password to the certificate above.

This doc talks about how to set the cert up: https://samuelmeuli.com/blog/2019-04-07-packaging-and-publishing-an-electron-app/#code-signing

The GitHub Action README describes how to put that cert into a GitHub Secret: https://github.com/samuelmeuli/action-electron-builder

If pushing builds to Snapcraft (Linux .snap marketplace) is desired, a token should be created and set on this GitHub secret:

Snaps work just fine without using Snapcraft, and I haven't set this fully up. So, this is an optional feature that can safely be ignored.

snapcraft_token

This doc talks about how to do that: https://abskmj.github.io/notes/posts/github/actions/setup-snapcraft/

Testing on Fork

  • Release build runs successfully on Ubuntu 20.04
  • Release build runs successfully on MacOS Monterey
  • Release build runs successfully on Windows 11
  • MacOS code-signing works
  • Snapcraft integration (Optional)

Manual steps required to get working on antonreshetov/image-optimizer

  • Create the mac_certs GH Secret with the MacOS dev cert
  • Create the mac_certs_password GH Secret with the password to that cert

Misc Notes

There's a PR (#19) for building on Windows. I believe this PR should still be compatible with that PR.

closes #18

electron-builder config moved to package.json to facilitate
integration with GitHub Actions
the electorn-builder gh action has the requirement that electron-builder
is not run by yarn build, so this part of the script was remove and
an additional build script was added to allow local builds
x32 devices are becoming uncommon; its likely that a user
mistakenly installs the x32 version; removing x32 target
to prevent users from installing the wrong version
removed macos armx64 build target to prevent users from
mistakenly installing it
remove fs import that was used for debugging; no longer needed
@antonreshetov
Copy link
Owner

@Christopher-Hayes Wow, so much work done. I'll be sure to check it out.

P.S. better of course first discuss before you start work, because it may be so that the work was in vain.

@Christopher-Hayes
Copy link
Contributor Author

Christopher-Hayes commented Jun 6, 2022

@antonreshetov you're right, I was thinking it would be quick little yaml file, but became a bit more complicated than expected 😁 Though, I'll admit the commit count is a bit high because I had to push commits to test the GitHub Action.

Feel free to comment on any lines you want to me to explain the reasoning behind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please add support for Linux
2 participants