Search code examples
gitlabcontinuous-integrationgitlab-cipipelinecicd

Pipeline stuck when commit after semantic release


I’ve recently run into an issue where my GitLab pipeline gets stuck after executing npx semantic release. This pipeline has been running smoothly until now, and I haven’t made any changes that would explain the failure.

Here’s what I observe in the logs:

$ npx semantic-release
[2:36:25 PM] [semantic-release] › ℹ  Running semantic-release version 21.1.2
[2:36:26 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
...
[2:38:01 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[10:11:58 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/git"
[10:12:02 PM] [semantic-release] [@semantic-release/git] › ℹ  Found 2 file(s) to commit
[8:00:41 AM] [semantic-release] › ✘  Failed step "prepare" of plugin "@semantic-release/git"

Solution

  • I have found this error. This error comes with the environment git version(v1.323.0) conflicting with package.json(v1.324.0) and package-lock.json(v1.324.0). Therefore I deleted the current version tag v1.324.0 and recreated the version tag. I have used these commands locally.

    1. Delete the conflicting tag:
    git tag -d v1.324.0
    
    1. Recreate the tag:
    git tag v1.324.0
    git push origin v1.324.0
    
    1. Run Semantic Release with the --no-ci flag to bypass CI checks:
    npx semantic-release --no-ci
    
    1. Commit the release with a message to skip CI:
    git commit -am "chore(release): 1.324.0 [skip ci] --no-verify"
    
    1. Push the updated tag to the repository:
    git push origin develop --tags