Easy, cleaned and updated action for building, compiling and releasing Electron applications
This is a GitHub Action for building and compiling Electron applications with GitHub CI/CD. It uses electron-builder
to compile and package the appication and optionally release it to a platform of your choice.
This action is an updated, refactored and cleaned up version of samuelmeuli/action-electron-builder
. The action hasn't gotten any updates in over 2 years and it was missing some basic features such as PNPM support. Basically a no nonsense action for Electron.
-
Configure your application and electron-builder.
-
Configure your workflow script. Either run build before we package electron or we run build default before packaging. You can configure this.
-
Add a workflow file to your project (e.g.
.github/workflows/build.yml
):name: Build/release on: push jobs: release: runs-on: ${{ matrix.os }} strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Check out Git repository uses: actions/checkout@v1 - name: Install Node.js, NPM and Yarn uses: actions/setup-node@v1 with: node-version: 16 - name: Compile Electron App uses: x6Pnda/action-electron-compiler@v1 with: # GitHub token, automatically provided to the action # (Optional) github_token: ${{ secrets.github_token }} # If the commit is tagged with a version (e.g. "v1.0.0"), # (Optional) release: ${{ startsWith(github.ref, 'refs/tags/v') }} # Package manager. NPM, PNPM and Yarn supported. Install Yarn and PNPM yourself. Default is NPM # (Optional) package_manager: NPM # Skip buiding the application # (Optional) skip_build: false
There are more options located in the action.yml
file. Good luck.
Using this the workflow above, GitHub will build your app every time you push a commit.
When you want to create a new release, follow these steps:
- Update the version in your project's
package.json
file (e.g.1.2.3
) - Commit that change (
git commit -am v1.2.3
) - Tag your commit (
git tag v1.2.3
). Make sure your tag name's format isv*.*.*
. Your workflow will use this tag to detect when to create a release - Push your changes to GitHub (
git push && git push --tags
)
After building successfully, the action will publish your release artifacts. By default, a new release draft will be created on GitHub with download links for your app. If you want to change this behavior, have a look at the electron-builder
docs.
Use your aftersign script. Make your life easy and copy paste it from @electron/notarize. You can use the environment variables APPLE_ID and APPLE_ID_PASSWORD to get the variables set inside the action. Will look into Windows at a later time. The point of this action is to compile, not to notarize. Don't create unicorns...
Create an issue or suggestion. Before submitting: don't overcomplicate things. Think is it really needed or something which makes it harder for other users.