Skip to content

Runtime error: PKG_INVALID_ZIP Invalid package. #89

@dmitrif

Description

@dmitrif

Issue

  • I have searched the issues of this repository and believe that this is not a duplicate.

Your Environment

  • semantic-release-chrome version: 1.1.3
  • node version: 16.6.1
  • npm version: 7.20.3

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)
  • archived asset file contains the entire working directory instead of just the dist folder contents.

Suggested solution

  • Fix path resolution for the archive step to deflate the correct folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions