hongaar / semantic-release-yarn

🧶 A semantic-release plugin to publish npm packages with Yarn. Comes with built-in support for monorepos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitLab CI build fails with No ancestor could be found between any of HEAD and master, origin/master, upstream/master, main, origin/main, upstream/main

BryanHuntNV opened this issue · comments

When running under GitLab CI, the plugin executes yarn version and I get the error:

No ancestor could be found between any of HEAD and master, origin/master, upstream/master, main, origin/main, upstream/main

I can run yarn version in the project just fine locally, but if I add that command to the GitLab CI job (and not use the plugin), I can reproduce the error. I suspect the problem is related to GitLab CI checking out the project in a detached head state.

I haven't been able to find a solution, so I may just write my own plugin that uses jq to update the package version.

It occurred to me today that a better solution might be to just parse the JSON, update the version and write it back out.

It's not very clear from the yarn docs, but one of the advantages of using yarn version is that it updates workspace: references in monorepos. See https://yarnpkg.com/cli/version/apply for more information.

Depending on your use-case, manually updating the version in package.json through a plugin may work, I'm not sure how though...

If we can solve this for everyone on GitLab it would be good. Not running GitLab atm but if you have more details I can help investigate.

Can you try setting the GIT_STRATEGY to clone:

variables:
  GIT_STRATEGY: clone

See also https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy

I added

variables:
  GIT_STRATEGY: clone

to my .gitlab-ci.yml and I get the same error.