jpoehnelt/semantic-release-replace-plugin

Error running on Gitlab CI

prisonerjohn opened this issue · 2 comments

Hello,

I'm trying to run this for a Unity project hosted on Gitlab and am running into the following error.

[2:09:17 AM] [semantic-release] › ℹ  Start step "prepare" of plugin "@google/semantic-release-replace-plugin"
[2:09:17 AM] [semantic-release] › ✖  Failed step "prepare" of plugin "@google/semantic-release-replace-plugin"
[2:09:17 AM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Results differed from actual! 
- Expected
+ Received
  Array [
    Object {
      "file": "ProjectSettings/ProjectSettings.asset",
-     "hasChanged": true,
-     "numMatches": 1,
-     "numReplacements": 1,
+     "hasChanged": false,
+     "numMatches": 0,
+     "numReplacements": 0,
    },
  ]
    at /builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:94:35
    at step (/builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:59:23)
    at Object.next (/builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:40:53)
    at fulfilled (/builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:31:58) {
  pluginName: '@google/semantic-release-replace-plugin'
}
Error: Results differed from actual! 
- Expected
+ Received
  Array [
    Object {
      "file": "ProjectSettings/ProjectSettings.asset",
-     "hasChanged": true,
-     "numMatches": 1,
-     "numReplacements": 1,
+     "hasChanged": false,
+     "numMatches": 0,
+     "numReplacements": 0,
    },
  ]
    at /builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:94:35
    at step (/builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:59:23)
    at Object.next (/builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:40:53)
    at fulfilled (/builds/amnh/wiam-test/node_modules/@google/semantic-release-replace-plugin/dist/index.js:31:58) {
  pluginName: '@google/semantic-release-replace-plugin'
}
ERROR: Job failed: exit code 1

My .releaserc file looks like this, I basically copied the example and replaced the file and version field:

{
  "branches": ["master"],
  "tagFormat": "v${version}",
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "angular"
      }
    ],
    "@semantic-release/release-notes-generator",
    [
      "@semantic-release/changelog",
      {
        "preset": "angular",
        "changelogFile": "CHANGELOG.md"
      }
    ],
    [
      "@google/semantic-release-replace-plugin",
      {
        "replacements": [
          {
            "files": ["ProjectSettings/ProjectSettings.asset"],
            "from": "bundleVersion: \".*\"",
            "to": "bundleVersion: \"${nextRelease.version}\"",
            "results": [
              {
                "file": "ProjectSettings/ProjectSettings.asset",
                "hasChanged": true,
                "numMatches": 1,
                "numReplacements": 1
              }
            ],
            "countMatches": true
          }
        ]
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": ["ProjectSettings/ProjectSettings.asset", "CHANGELOG.md"],
        "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ]
  ]
}

I'm not sure what that error means, any idea what is going wrong (and is it on my end)?

Thank you!

Sorry for the bad error message! This actually means one of the replacements didn't find a match. I guess this would be considered strict mode. I'll fix this!

🎉 This issue has been resolved in version 1.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀