JonasKruckenberg / tauri-build

MIT License
30 stars 8 forks source link

NSIS Installer Output not picked up as output #299

Open 8 opened 11 months ago

8 commented 11 months ago

Hi,

I have the following issue when trying to upload the artifacts of this action when using a a Nsis installer output (the upload works fine for macOS and linux builds btw).

The build for windows works fine, we can see that the artifacts are created in the github log:

    Finished 1 bundle at:
        D:\a\projectname\projectname\src-tauri\target\release\bundle\nsis\projectname_0.7.0-BETA_x64-setup.exe
        D:\a\projectname\projectname\src-tauri\target\release\bundle\nsis\projectname_0.7.0-BETA_x64-setup.nsis.zip (updater)

    Finished 1 updater signature at:
        D:\a\projectname\projectname\src-tauri\target\release\bundle\nsis\projectname_0.7.0-BETA_x64-setup.nsis.zip.sig

But the upload artifact action fails:

Run actions/upload-artifact@v3
Error: Input required and not supplied: path

The github workflow code was taken from the README.md and modified to only produce the nsis &updater output (-b nsis,updater), the relevant sections look like this:

      - uses: JonasKruckenberg/tauri-build@main
        id: tauri_build
        with:
          args: "${{ matrix.platform == 'windows-latest' && '-b nsis,updater --ci' || '' }}"

      - uses: actions/upload-artifact@v3
        with:
          name: artifacts
          path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}"

My assumption is, that the output variable of tauri_build is not correctly set for the nsis installer output.

I've found issue: https://github.com/JonasKruckenberg/tauri-build/issues/266 which mentions that the output of the nsis installer should be fixed - I've tried out main and v1.4 and verified that the problem persists.

I've cloned the tauri-build action and took a look at the code and found the windows extensions code in build-projects.ts:

  const windowsExts = ['exe', 'exe.zip', 'exe.zip.sig', 'msi', 'msi.zip', 'msi.zip.sig']

Which is IMHO missing some relevant entries for the nsis output as shown in the github action log above, like nsis.zip and nsis.zip.sig.

For comparison, I've looked at the "official" github action tauri-action, the relevant code in build.ts looks like:

    ...
    winArtifacts.push(
      join(
        artifactsPath,
        `bundle/nsis/${fileAppName}_${app.version}_${arch}-setup.exe`
      )
    );
    winArtifacts.push(
      join(
        artifactsPath,
        `bundle/nsis/${fileAppName}_${app.version}_${arch}-setup.nsis.zip`
      )
    );
    winArtifacts.push(
      join(
        artifactsPath,
        `bundle/nsis/${fileAppName}_${app.version}_${arch}-setup.nsis.zip.sig`
      )
    );

I think that at least nsis.zip and nsis.zip.sig are missing in the windowsExts variable.

What I don't yet understand is, why is the output completely empty? Shouldn't at least the nsis .exe be picked up?

I just started using the github ci yesterday and I am new to github actions don't know how I would go about testing a potential fix of the action?

Any pointers are welcome, thanks!

Take care, Martin

8 commented 11 months ago

I figured out that I can just reference a fork of the action in the workflow. I'll see if I can find a fix now...

8 commented 11 months ago

Okay, I think I now know why the exe is not being picked up:

It seems that the change was only done in the .ts file, but the action itself is compiled to index.js which is also checked in, but this was not updated - yikes!

https://github.com/JonasKruckenberg/tauri-build/blob/main/dist/index.js#L112

Take care, Martin

8 commented 11 months ago

Hi,

after manually updating the index.js (how do you build this guy?! I got no dice going down the npm install & npm run build route) the actions output was set correctly and the upload worked as shown in the CI Log:

Run 8/tauri-build@fix-nsis
  with:
    args: -b nsis,updater --ci
...
     Running makensis.exe to produce D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.exe
    Bundling D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.nsis.zip
    Finished 1 bundle at:
        D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.exe
        D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.nsis.zip (updater)

    Finished 1 updater signature at:
        D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.nsis.zip.sig

Followed by the upload:

Run actions/upload-artifact@v3
  with:
    name: artifacts
    path: D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.exe
  D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.nsis.zip
  D:\a\project\project\src-tauri\target\release\bundle\nsis\project_0.7.0-BETA_x64-setup.nsis.zip.sig
    if-no-files-found: warn

I've created a pull request (https://github.com/JonasKruckenberg/tauri-build/pull/300) that includes the typescript as well as the manually patched index.js file so that the pull request actually works, but I've split them up into 2 commits, one for the real source code build-project.ts and the 2nd to fix the index.js

The 2nd commit feels dirty, as I updated the file by hand, but on the other hand the process of building the index.js file is flawed anyway, as it was not updated after the last build-project.ts change that put the exe extension there.

So what I want to say is that you may want to fix the issue of the index.js file being not build automatically first and then take only the first commit as a fix.

Take care, Martin