Cannot make prerelease always fails with was triggered on the branch ci_features_1, while semantic-release is configured to only publish from main
Describe the bug
I am trying to get a working setup where main is a regular release and any other branch is a prerelease
Expected behavior
Prerelease created
Actual behavior
Getting the following in the log "This test run was triggered on the branch ci_features_1, while semantic-release is configured to only publish from main, therefore a new version won’t be published."
Logs and/or screenshots
Log from semantic-release-info
$ cd "${SEMREL_CONFIG_DIR}"
$ prepare_semantic_release
[INFO] .releaserc.yml file found
$ install_semantic_release_plugins
[INFO] installing required plugins
npm warn deprecated semver-diff@5.0.0: Deprecated as the semver package now supports this built-in.
added 525 packages in 11s
115 packages are looking for funding
run `npm fund` for details
added 5 packages in 277ms
[INFO] Globally installed packages...
/usr/local/lib
+-- @semantic-release/changelog@6.0.3
+-- @semantic-release/commit-analyzer@13.0.1
+-- @semantic-release/git@10.0.1
+-- @semantic-release/gitlab@13.2.9
+-- @semantic-release/npm@13.1.3
+-- @semantic-release/release-notes-generator@14.1.0
+-- conventional-changelog-angular@8.1.0
+-- corepack@0.34.5
+-- npm@11.6.2
`-- semantic-release@25.0.2
$ clear_vault_env
$ dotenv_semrel_info
generated analyzeCommits hook script:
#!/bin/bash
{
echo "SEMREL_INFO_LAST_VERSION=$1"
} > "/tmp/semrel-info-ZVNAwwxYuF.dotenv"
generated verifyRelease hook script:
#!/bin/bash
{
echo "SEMREL_INFO_NEXT_VERSION=$1"
echo "SEMREL_INFO_NEXT_VERSION_TYPE=$2"
} >> "/tmp/semrel-info-ZVNAwwxYuF.dotenv"
[INFO] --- generated .releaserc:
branches:
- name: main
prerelease: false
channel: false
- name: /^(?!main$).+$/
channel: false
prerelease: true
# This regex matches any branch except 'main'
tagFormat: ${version}
# injected (replace your plugins) plugins by the template to generate dotenv
plugins:
- - '@semantic-release/commit-analyzer'
- preset: 'angular'
- - '@semantic-release/exec'
- analyzeCommitsCmd: '"./export-last-version.sh" "${lastRelease.version}"'
verifyReleaseCmd: '"./export-next-version.sh" "${nextRelease.version}" "${nextRelease.type}"'
npm warn deprecated semver-diff@5.0.0: Deprecated as the semver package now supports this built-in.
added 99 packages, and changed 237 packages in 4s
98 packages are looking for funding
run `npm fund` for details
[2:08:53 PM] [semantic-release] › ℹ Running semantic-release version 25.0.2
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "verifyRelease" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/exec"
[2:08:54 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/exec"
[2:09:00 PM] [semantic-release] › ℹ This test run was triggered on the branch ci_features_1, while semantic-release is configured to only publish from main, therefore a new version won’t be published.
Log from semantic-release
$ cd "${SEMREL_CONFIG_DIR}"
$ prepare_semantic_release
[INFO] .releaserc.yml file found
$ install_semantic_release_plugins
[INFO] installing required plugins
npm warn deprecated semver-diff@5.0.0: Deprecated as the semver package now supports this built-in.
added 525 packages in 11s
115 packages are looking for funding
run `npm fund` for details
added 5 packages in 254ms
[INFO] Globally installed packages...
/usr/local/lib
+-- @semantic-release/changelog@6.0.3
+-- @semantic-release/commit-analyzer@13.0.1
+-- @semantic-release/git@10.0.1
+-- @semantic-release/gitlab@13.2.9
+-- @semantic-release/npm@13.1.3
+-- @semantic-release/release-notes-generator@14.1.0
+-- conventional-changelog-angular@8.1.0
+-- corepack@0.34.5
+-- npm@11.6.2
`-- semantic-release@25.0.2
$ clear_vault_env
$ configure_commit_signing
[INFO] No GPG key provided.
$ if [[ "$SEMREL_DRY_RUN" == "true" ]]; then dry_run_opt="--dry-run"; fi
$ semantic-release ${TRACE:+--debug} --ci $dry_run_opt $SEMREL_EXTRA_ARGS
[3:07:50 PM] [semantic-release] › ℹ Running semantic-release version 25.0.2
2025-12-15T15:07:50.194Z semantic-release:config load config from: /builds/henrik-lynggaard-hansen/recipebook-openspec/.releaserc.yml
2025-12-15T15:07:50.201Z semantic-release:config options values: {
branches: [
{ name: 'main', prerelease: [secure], channel: [secure] },
{ name: '/^(?!main$).+$/', channel: [secure], prerelease: true }
],
repositoryUrl: 'https://gitlab.com/henrik-lynggaard-hansen/recipebook-openspec.git',
tagFormat: '${version}',
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/changelog',
[ '@semantic-release/npm', [Object] ],
'@semantic-release/git',
'@semantic-release/gitlab'
],
_: [],
debug: true,
ci: true,
'$0': 'semantic-release'
}
2025-12-15T15:07:51.252Z semantic-release:plugins options for @semantic-release/changelog/verifyConditions: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
2025-12-15T15:07:51.253Z semantic-release:plugins options for @semantic-release/npm/verifyConditions: { npmPublish: [secure] }
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
2025-12-15T15:07:51.253Z semantic-release:plugins options for @semantic-release/git/verifyConditions: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
2025-12-15T15:07:51.254Z semantic-release:plugins options for @semantic-release/gitlab/verifyConditions: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
2025-12-15T15:07:51.254Z semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
2025-12-15T15:07:51.254Z semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
2025-12-15T15:07:51.255Z semantic-release:plugins options for @semantic-release/changelog/prepare: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
2025-12-15T15:07:51.255Z semantic-release:plugins options for @semantic-release/npm/prepare: { npmPublish: [secure] }
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
2025-12-15T15:07:51.255Z semantic-release:plugins options for @semantic-release/git/prepare: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/git"
2025-12-15T15:07:51.256Z semantic-release:plugins options for @semantic-release/npm/publish: { npmPublish: [secure] }
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
2025-12-15T15:07:51.256Z semantic-release:plugins options for @semantic-release/gitlab/publish: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/gitlab"
2025-12-15T15:07:51.256Z semantic-release:plugins options for @semantic-release/npm/addChannel: { npmPublish: [secure] }
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
2025-12-15T15:07:51.256Z semantic-release:plugins options for @semantic-release/gitlab/success: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/gitlab"
2025-12-15T15:07:51.256Z semantic-release:plugins options for @semantic-release/gitlab/fail: {}
[3:07:51 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/gitlab"
2025-12-15T15:07:51.284Z semantic-release:get-git-auth-url Verifying ssh auth by attempting to push to https://gitlab.com/XXXX/recipebook-openspec.git
2025-12-15T15:07:51.907Z semantic-release:get-git-auth-url SSH key auth successful.
2025-12-15T15:07:56.854Z semantic-release:git SyntaxError: "undefined" is not valid JSON
at JSON.parse (<anonymous>)
at getTagsNotes (file:///usr/local/lib/node_modules/semantic-release/lib/git.js:346:27)
at async default (file:///usr/local/lib/node_modules/semantic-release/lib/branches/get-tags.js:17:24)
at async default (file:///usr/local/lib/node_modules/semantic-release/lib/branches/index.js:26:20)
at async run (file:///usr/local/lib/node_modules/semantic-release/index.js:68:22)
at async Module.default (file:///usr/local/lib/node_modules/semantic-release/index.js:278:22)
at async default (file:///usr/local/lib/node_modules/semantic-release/cli.js:55:5)
2025-12-15T15:07:56.863Z semantic-release:get-tags found tags for branch main: [ { gitTag: '0.0.1', version: '0.0.1', channels: [ null ] } ]
[3:07:56 PM] [semantic-release] › ℹ This test run was triggered on the branch ci_features_1, while semantic-release is configured to only publish from main, therefore a new version won’t be published.
Context & Configuration
Link to a project, pipeline or job facing the bug: (please provide one if possible)
The issue was reproduced using:
- Version of the template: 4.0.1
- GitLab server(s): Gitlab.com Free account
- GitLab runner(s): Selfhosted, docker executed.
Here is the .gitlab-ci.yml file:
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version"
IMAGE_NAME: "$CI_REGISTRY_IMAGE"
CACHE_VERSION: "v1"
POSTGRES_DB: XXXX
POSTGRES_USER: XXXX
POSTGRES_PASSWORD: XXX
POSTGRES_HOST_AUTH_METHOD: trust
TRACE: true
include:
- component: $CI_SERVER_FQDN/to-be-continuous/semantic-release/gitlab-ci-semrel@4.0.1
inputs:
branches-ref: "/.*/"
info-on: all
auto-release-enabled: true
stages:
- .pre
- build
- publish
default:
image: maven:3.9.6-eclipse-temurin-21
services:
- postgres:18-alpine
- docker:dind
cache:
key:
files:
- pom.xml
- src/main/webui/package-lock.json
paths:
- .m2/repository/
- "**/node_modules/"
build:
before_script:
- apt-get update
- apt-get install -y unzip build-essential zlib1g-dev zip curl tar tree
- curl -s "https://get.sdkman.io" | bash
- export SDKMAN_DIR="$HOME/.sdkman" # Manually set the directory variable
- source "$SDKMAN_DIR/bin/sdkman-init.sh" # Source the init script in the *current* shell session
- sdk install java 21.0.2-graalce
- sdk use java 21.0.2-graalce
- java -version
- mvn -version
- mkdir -p .m2/repository
stage: build
script:
# Execute Maven to build both backend and frontend (Quinoa handles frontend)
- echo "Building application with Maven and Quinoa integration"
- mvn $MAVEN_CLI_OPTS clean verify -Pnative -Dquarkus.native.container-build=false
artifacts:
name: "build-artifacts-$CI_COMMIT_SHORT_SHA"
paths:
- target/classes/
- target/backend-*-runner
- target/quarkus-artifact.properties
- target/generated-sources/
- target/generated-test-sources/
reports:
junit:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml
expire_in: 2 hours# Add your .gitlab-ci.yml here, if applicable and useful.
(If useful, list configured GitLab CI project and/or group variables.)
Configured GitLab CI project or group variables:
GITLAB_TOKEN
.releaserc.yml file:
branches:
- name: main
prerelease: false
channel: false
- name: "/^(?!main$).+$/"
channel: false
prerelease: true
# This regex matches any branch except 'main'
tagFormat: "${version}"
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- ["@semantic-release/npm", { "npmPublish": false }]
- "@semantic-release/git"
- "@semantic-release/gitlab"