GoReleaser "git doesn't contain any tags" in CI
GoReleaser computes the release version from the most recent git tag. The default GitHub Actions checkout is shallow with no tags, so GoReleaser sees an untagged repository and stops.
What this error means
GoReleaser exits immediately with "git doesn't contain any tags" or "get tag: ... fatal: No names found", even though the repository has tags on the remote.
Terminal
⨯ release failed after 0s
error=git doesn't contain any tags. Either add a tag or use --snapshotCommon causes
The checkout has no tags
actions/checkout defaults to fetch-depth: 1 and does not fetch tags, so GoReleaser finds none in the local clone.
The workflow did not trigger on a tag
A push to a branch has no tag to release from; GoReleaser needs a tag ref (or --snapshot) to derive a version.
How to fix it
Fetch full history and tags in checkout
- Set
fetch-depth: 0on actions/checkout so the full history and all tags are present. - Trigger the release job on tag pushes (
on: push: tags). - Re-run so GoReleaser can read the current tag.
.github/workflows/release.yml
- uses: actions/checkout@v4
with:
fetch-depth: 0Use --snapshot for untagged builds
For dry-run or branch builds without a tag, --snapshot fabricates a version so the build proceeds.
Terminal
goreleaser release --snapshot --cleanHow to prevent it
- Always set
fetch-depth: 0in the checkout step before GoReleaser. - Trigger release jobs on tag pushes, not branch pushes.
- Use
--snapshotfor non-release CI runs that only test the build.
Related guides
GoReleaser "failed to fetch tags" (shallow clone) in CIFix GoReleaser tag-fetch failures in CI - a shallow checkout means the wrong or missing tag is used for the r…
GoReleaser "is not a valid semver tag" in CIFix GoReleaser "is not a valid semver tag" in CI - the git tag being released does not follow the vMAJOR.MINO…
GoReleaser "git is currently in a dirty state" in CIFix GoReleaser "git is currently in a dirty state" in CI - uncommitted or generated files make the working tr…