semantic-release: branch is always undefined when used in TeamCity build step

Current behavior

I commited a change on my local release branch and pushed it to origin/release. My TeamCity Build is being triggered and the Build Steps are processes. When using npx semantic-release@15 in my TeamCity Command Line build step the branch is allegedly seen as undefined.

[01:51:53][Step 9/9] [1:51:53 AM] [semantic-release] › ℹ  This test run was triggered on the branch undefined, while semantic-release is configured to only publish from release, therefore a new version won’t be published.

Expected behavior

I expect the release branch to be recognized.

Environment

  • semantic-release version: 15.12.0
  • CI environment: TeamCity Command Line Build Step

Command Line Script

echo "exec: ls -alt"
ls -alt
echo "installing npx"
npm install -g npx;
echo "current branch:"
git branch
echo "git tag"
git tag
echo "commits since v0.0.1:"
git log --pretty=oneline v0.0.1..HEAD
echo "installing & executing semantic-release@15"
npx semantic-release@15 --debug
  • Plugins used:
[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[01:51:53]	[Step 9/9] [1:51:53 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
  • semantic-release configuration: YAML
repositoryUrl: https://github.com/CoopR-Mod/CoopR-HQ
branch: release

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 32 (14 by maintainers)

Most upvoted comments

This should be fixed in env-ci@3.1.2. Please re-open if it’s not the case.

Please also open an issue with TeamCity and share the link here as it would be nice to have an answer from them about a consistent way to obtain the branch on which the build is running on.

Yes, please ask them what is the proper way to obtain the branch that triggered the build.