feat(ng-dev/release): implement publish-ci command and tests#3774
feat(ng-dev/release): implement publish-ci command and tests#3774josephperrott wants to merge 1 commit into
Conversation
9c26aae to
2c7699f
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces a new publish-ci command and PublishCiTool to support publishing releases directly from CI, alongside a stage-only option for the existing publish command to allow staging a release and exiting early. To support these additions, the PR introduces a StageOnlySuccessError for clean exits, updates action constructors, and adds extensive test coverage. Feedback on the changes highlights a potential issue in PublishCiTool where listing tags might fail in CI environments due to shallow clones, suggesting an explicit git fetch --tags before querying tags.
| let previousVersionTag: string; | ||
| if (newSemver.prerelease.length === 0 && versionAtBeforeStagingSemver.prerelease.length > 0) { | ||
| // Stable release compared to prerelease. We must find the previous stable version. | ||
| const tagsOutput = this.git.run(['tag', '-l', 'v*']).stdout.trim(); |
There was a problem hiding this comment.
In a CI environment, repositories are typically cloned using a shallow clone or without fetching all tags (for example, the default behavior of actions/checkout in GitHub Actions is fetch-depth: 1 and no tags).
If the tags are not fetched, git tag -l 'v*' will return an empty list or be incomplete. This will cause the tool to fail to find the previous stable version tag, throwing an error or failing during the release notes generation range check.
To ensure robustness in CI, we should explicitly fetch the tags from the remote repository before listing them.
| const tagsOutput = this.git.run(['tag', '-l', 'v*']).stdout.trim(); | |
| this.git.run(['fetch', '--tags', this.git.getRepoGitUrl()]); | |
| const tagsOutput = this.git.run(['tag', '-l', 'v*']).stdout.trim(); |
References
- Ensure all required git metadata (such as tags) is explicitly fetched from the remote in CI environments to prevent failures due to shallow or incomplete clones.
47a4e9a to
9e264d4
Compare
9e264d4 to
97fc764
Compare
This PR implements the publish-ci command for CI-driven publishing, including monorepo-style tagging support and full unit tests. Stacked on top of the staging CLI changes.