GabeDuarteM / semantic-release-chrome

Set of semantic-release plugins for publishing a Chrome extension release
https://www.npmjs.com/package/semantic-release-chrome
MIT License
43 stars 16 forks source link

Runtime error: PKG_INVALID_ZIP Invalid package. #89

Open dmitrif opened 2 years ago

dmitrif commented 2 years ago

Issue

Your Environment

Relevant code or config

  "release": {
    "branches": [
      "main"
    ],
    "plugins": [
      "@semantic-release/release-notes-generator",
      [
        "semantic-release-chrome",
        {
          "asset": "asset.zip",
          "extensionId": "XXX"
        }
      ],
      [
        "@semantic-release/github",
        {
          "assets": [
            "asset.zip"
          ]
        }
      ]
    ]
  },

What you did and problem description

Running with above configuration results in the following error, failing the rest of the release steps:

Invalid package. Please make sure it is a valid zip file and the file manifest.json is at the root directory of the zip package.

Upon further inspection, it seems like the archived asset file contains the entire working directory instead of just the dist folder contents.

Theory: It seems like the path resolution points to a non-existent folder, and the archiver falls back to current folder.

What happened

[6:02:33 AM] [semantic-release] › ✖  PKG_INVALID_ZIP Invalid package. Please make sure it is a valid zip file and the file manifest.json is at the root directory of the zip package.
AggregateError: 
    SemanticReleaseError: Invalid package. Please make sure it is a valid zip file and the file manifest.json is at the root directory of the zip package.
        at /home/runner/work/xx/xx/node_modules/semantic-release-chrome/dist/publish.js:52:29
        at Array.forEach (<anonymous>)
        at publish (/home/runner/work/xx/xx/node_modules/semantic-release-chrome/dist/publish.js:51:25)
        at runMicrotasks (<anonymous>)
        at async validator (/home/runner/work/xx/xx/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
        at async /home/runner/work/xx/xx/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
        at async Promise.all (index 0)
        at async next (/home/runner/work/xx/xx/node_modules/p-reduce/index.js:16:18)
    at publish (/home/runner/work/xx/xx/node_modules/semantic-release-chrome/dist/publish.js:55:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async validator (/home/runner/work/xx/xx/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /home/runner/work/xx/xx/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/home/runner/work/xx/xx/node_modules/p-reduce/index.js:16:18)

Suggested solution

GabeDuarteM commented 2 years ago

Hey 👋👋

Thats weird, I've been using it for a few extensions and its been working normally...

Some questions:

mormubis commented 2 years ago

Hey @GabrielDuarteM, I had the same issue as the issue author.

I forked the project and removed this line. It worked :\

I am not sure the reason, but it worked

DannyAziz commented 1 year ago

Also getting this problem all of a sudden, was working fine for ages and just stopped working today