Publish First Release
Note
Note: This guide assumes you are using semantic-release for versioning and publishing your packages.
When you are publishing a package for the first time, you might encounter issues with the versioning process. This is because semantic-release uses the commit history to determine the version number based on the conventional commit messages. If the commit history does not follow the conventional commit style, semantic-release might not be able to determine the correct version number.
Note: Set the
--first-release=trueflag to publish the first release of a package. This flag is used to bypass the conventional commit style and publish the first release of a package.
"nx:pub": "nx release --verbose=true --first-release=true",
After a First Release
To resolve this issue, consider the following possibilities:
-
Verify Git Tags: Ensure that Git tags are properly created and pushed, as the
currentVersionResolveris usinggit-tagto identify the current version. -
Conventional Commits: Check that the commit messages truly follow the conventional commit style. The most important part here is that commit messages must follow the specified convention to be detected by tools like semantic release. For example,
fix: some bug fixshould trigger a version bump from13.0.1to13.0.2. -
First Release flag: The
--first-release=trueflag seems to suggest an initial release, disregarding conventional commits for versioning. Remove this flag if the goal is version incrementing based on commit history. -
Commit History: Ensure that the commits you made are present in the branch that your CI is running on and that they haven't been squashed or rebased in a way that would strip the conventional structure.
-
Configuration Consistency: Double-check your configuration for generatorOptions. Ensure all necessary settings are properly set and that there is no conflict between settings, especially around version determination and changelog generation.
Try running the release process without the --first-release option and ensure all conventional commit messages are in the expected format. If the problem persists, adding debugging steps to output the relevant commit messages and tags could also help in diagnosing the issue.