git icon indicating copy to clipboard operation
git copied to clipboard

Seems to be updating some files but not others

Open jhackett1 opened this issue 3 years ago • 2 comments

Hello,

I'm not sure if this is a bug or my own misuse of the plugin.

I'm having an issue with the plugin updating some files on release (changelog and package.json) but not others on this repository.

Part of the release workflow (via a prepublishOnly npm script) is to build some CSS and JS bundles to the /dist folder.

Here's an example of the commit semantic-release is making.

Because my release config looks like this, I'd expect these assets to be commited to the git repo, but this doesn't seem to be happening:

"release": {
    "branches": [
      "main"
    ],
    "plugins": [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      "@semantic-release/npm",
      "@semantic-release/github",
      [
        "@semantic-release/changelog",
        {
          "changelogFile": "CHANGELOG.md"
        }
      ],
      [
        "@semantic-release/git",
        {
          "assets": [
            "dist/**/*.{js,css}",
            "package.json",
            "CHANGELOG.md"
          ],
          "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
        }
      ]
    ]
  }

This doesn't seem to be a token issue because it can update the package.json and changelog files successfully.

Could be related to: https://github.com/semantic-release/git/issues/155

Any thoughts?

jhackett1 avatar Mar 22 '21 14:03 jhackett1

I am facing a pretty similar issue, I thought it could have something to do with me triggering the command from the subfolder, not the root, but when I tried to put a bunch of git status to @semantic-release/exec I saw that files are generated/updated but they're somehow ignored by @semantic-release/git.

Here's my config:

{
  "branches": [
    "main"
  ],
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "@semantic-release/changelog",
      {
        "changelogFile": "../../CHANGELOG.md"
      }
    ],
    "@semantic-release/github",
    [
      "@google/semantic-release-replace-plugin",
      {
        "replacements": [
          {
            "files": [
              "../../mix.exs"
            ],
            "from": "version: \".*\"",
            "to": "version: \"${nextRelease.version}\"",
            "results": [
              {
                "file": "../../mix.exs",
                "hasChanged": true,
                "numMatches": 1,
                "numReplacements": 1
              }
            ],
            "countMatches": true
          }
        ]
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": [
          "mix.exs",
          "CHANGELOG.md"
        ],
        "message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
      }
    ]
  ]
}

Geril avatar Apr 15 '21 17:04 Geril

I am facing the same issue here. With @semantic-release/exec I update my libs versions and the peer dependencies. Running git status at the prepareCmd of @semantic-release/exec shows me the updated files, but @semantic-release/git is not picking up those changes. It only adds package.json, package-lock.json and the CHANGELOG.md to the repository. What am I doing wrong here?

EDIT: Found a comment that should resolve the issue https://github.com/semantic-release/git/issues/155#issuecomment-535178631

mehrad-rafigh avatar Aug 02 '21 14:08 mehrad-rafigh