Skip to content

Add SNAPSHOT-version guard to publish.yaml workflows #61

@amavashev

Description

@amavashev

Issue

The `publish.yaml` workflows across Cycles Java repos run `mvn -B -Prelease clean deploy` on `release` events without a build-time check that the pom version is not a SNAPSHOT. Example: `cycles-spring-boot-starter/.github/workflows/publish.yaml` and the matching workflow on `cycles-spring-ai-starter`.

If someone cuts a GitHub release while the pom version is still `x.y.z-SNAPSHOT`, the workflow runs and `mvn deploy` attempts to publish. Sonatype Central rejects SNAPSHOT versions server-side, so the actual harm is "noisy publish failure" rather than "published a snapshot to Central." But a fast-fail before the deploy phase would surface the operator error more clearly.

Proposed fix

Add a step in `publish.yaml` right after JDK setup:

```yaml

  • name: Verify version is not SNAPSHOT
    working-directory: ${{ matrix.module-dir }}
    run: |
    VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
    if [[ "$VERSION" == SNAPSHOT ]]; then
    echo "::error::Cannot publish SNAPSHOT version: $VERSION. Drop -SNAPSHOT before tagging."
    exit 1
    fi
    echo "Publishing version: $VERSION"
    ```

Affected repos

Every Cycles repo that has a publish.yaml workflow targeting Maven Central:

  • cycles-spring-boot-starter
  • cycles-spring-ai-starter
  • (and Python/TS equivalents if they have similar issues with PyPI / npm)

Surface

Original review finding from PR #1 on cycles-spring-ai-starter (2026-05-12). Tracking org-wide because the same pattern exists across publish workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions