samuelmeuli / action-electron-builder

:electron: GitHub Action for building and releasing Electron apps
MIT License
670 stars 207 forks source link

A wrong configuration #66

Closed catmans1 closed 3 years ago

catmans1 commented 3 years ago

I used this tool with version v1.6.0 And it occurred the error

Application entry file "build/electron/main.js" in the "/Users/runner/work/my-app/my-app/dist/mac/My App.app/Contents/Resources/MyApp.asar" does not exist. Seems like a wrong configuration. failedTask=build stackTrace=Error: Application entry file "build/electron/main.js" in the "/Users/runner/work/my-app/my-app/dist/mac/MyApp.app/Contents/Resources/app.asar" does not exist. Seems like a wrong configuration.

How can solve it?

Thank you!

hcmlopes commented 3 years ago

@catmans1 I had an issue similar to this and I will try to be as detailed as possible so that even if it doesn't help you because of your setup it may help others.

First here is my setup. The project uses: Vue JS ^2.6.11 Vue CLI Plugin Electron Builder ~2.0.0-rc.4

The issue for me was in the github action configuration. I searched for months on and off as I would get frustrated however the answer was in the readme file here all along.

Basically I had to tell action-electron-builder that I was using the Vue CLI Plugin Electron Builder and have "main": "background.js" key:value pair specified in my package.json

Based on your description here you should change that to main.js or make sure that this is the correct file name you should be pointing to.

Another problem I had was that to have the action automatically create a draft on github I had to pass the correct args as with out the args it will only upload the compiled app if you already have a draft release.

Here is what my github action main.yml looks like

# This is a basic workflow to help you get started with Actions

name: Build/release

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches:
      - master

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  release:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [windows-latest, macos-latest]

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - name: Install Node.js, NPM and Yarn
        uses: actions/setup-node@v1
        with:
          node-version: 14

      - name: Build/release Electron app
        uses: samuelmeuli/action-electron-builder@v1
        with:
          # GitHub token, automatically provided to the action
          # (No need to define this secret in the repo settings)
          github_token: ${{ secrets.github_token }}
          use_vue_cli: true
          args: "-p always"

          # If the commit is tagged with a version (e.g. "v1.0.0"),
          # release the app after building
          release: ${{ startsWith(github.ref, 'refs/tags/v') }}
catmans1 commented 3 years ago

@hcmlopes Thank you for you reply, I think so. Anyway, I've changed to CI 😅