Publishing
Bleep has built-in publishing to local repositories, private Maven registries, and Sonatype / Maven Central.
Quick Start
Add publish config to your project:
projects:
mylib:
publish:
groupId: io.github.myname
Then publish:
# To GitHub Packages
bleep publish github --to myname/myrepo --version 0.1.0
# To local ivy cache
bleep publish local --version 0.1.0
# With git tag versioning (no --version needed)
git tag v0.1.0
bleep publish github --to myname/myrepo
Interactive Setup
bleep publish setup
This wizard walks you through configuring your publishing target. For Sonatype, it generates GPG keys and tells you which CI environment variables to set.
Configuration
The publish field
Add publish to any project (or template) to mark it as publishable:
templates:
template-publishable:
publish:
groupId: com.mycompany
repository: company-releases # named resolver
description: My library
url: https://github.com/mycompany/mylib
organization: My Company
developers:
- id: dev1
name: Developer One
url: https://github.com/dev1
licenses:
- name: MIT
url: http://opensource.org/licenses/MIT
distribution: repo
projects:
mylib:
extends: template-publishable
publish:
description: Specific lib description # overrides template
mylib-tests:
# no publish field = not published
Projects without publish are never published. All publish fields merge through templates using the same rules as other bleep config.
Named resolvers
Give your resolvers names so you can reference them from publish.repository:
resolvers:
- name: company-releases
type: maven
uri: artifactregistry://europe-north1-maven.pkg.dev/project/release
All publish fields
| Field | Description |
|---|---|
groupId | Maven groupId (required) |
repository | Named resolver to publish to |
description | Project description (POM) |
url | Project homepage (POM) |
organization | Organization name (POM) |
developers | List of {id, name, url} (POM) |
licenses | List of {name, url, distribution} (POM) |
sonatypeProfileName | Sonatype profile (defaults to groupId) |
sonatypeCredentialHost | Sonatype host (defaults to central.sonatype.com) |
Publishing Targets
Local
bleep publish local # to ~/.ivy2
bleep publish local --to /path/to/repo # to custom maven folder
GitHub Packages
bleep publish github --to owner/repo
Credentials come from gh auth token. Prerequisites: install GitHub CLI, run gh auth login.
Google Artifact Registry
bleep publish artifactregistry --to artifactregistry://region-maven.pkg.dev/project/repo
Credentials come from gcloud auth print-access-token. Prerequisites: install Google Cloud SDK, run gcloud auth login.
For multi-account setups, configure which account to use:
bleep config auth setup
GitLab Package Registry
bleep publish gitlab --to gitlab://gitlab.com/api/v4/projects/12345/packages/maven
Credentials come from glab auth token. Prerequisites: install GitLab CLI, run glab auth login.
Sonatype / Maven Central
bleep publish sonatype
This compiles, packages, signs with GPG, generates checksums, and uploads to Maven Central. Version is derived from git tags automatically (via DynVer).
Prerequisites
- A Sonatype account at central.sonatype.com
- Publishing rights for your groupId
- GPG key for signing artifacts
- CI environment variables set
First-time setup
Run bleep publish setup and select "Sonatype / Maven Central". The wizard will:
- Generate a GPG key pair
- Upload the public key to a keyserver
- Tell you exactly which CI environment variables to set
Environment variables
| Variable | Description |
|---|---|
SONATYPE_USERNAME | Sonatype user token username |
SONATYPE_PASSWORD | Sonatype user token password |
PGP_SECRET | Base64-encoded GPG private key |
PGP_PASSPHRASE | GPG key passphrase |
Get Sonatype tokens at: central.sonatype.com > username > View Account > Generate User Token.
Version Management
Version is determined by (in priority order):
--version Xflag, explicit override- Git tags via DynVer, automatic, derived from
git describe
DynVer examples:
- On tag
v1.0.0(clean) →1.0.0 - 3 commits after
v1.0.0→1.0.0+3-abcdef12 - Dirty working tree →
1.0.0+0-abcdef12+20260327-1430
For Sonatype, snapshot versions (any version not cleanly on a tag) get -SNAPSHOT appended.
Getting the version into the artifact
To read the version at runtime, declare stamp: [dynver] on the project and read bleep-stamp/<project>.properties from the classpath — see build stamps. It comes from the same derivation as the version above, and --version X stamps X, so the coordinate a jar is published under and the value inside it cannot disagree.
Project Selection
bleep publish local mylib mylib2: publish specific projectsbleep publish local: publish all projects withpublishconfig
CI/CD Integration
Bleep is CI-agnostic. Set the required environment variables in your CI system and run bleep publish <target>. Example for GitHub Actions:
on:
push:
tags: ["v*"]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: coursier/setup-action@v1
- run: bleep publish sonatype
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Troubleshooting
"No publishable projects found"
Add publish config with at least groupId to your projects or templates.
"No --version specified"
For publish local/artifactregistry/github/gitlab: either pass --version X or ensure your repo has git tags (e.g. git tag v0.1.0). The sonatype subcommand handles versioning automatically.
GPG / PGP errors
Run bleep publish setup to regenerate keys. Ensure PGP_SECRET is base64-encoded without line breaks.
Sonatype 401 Unauthorized
Verify SONATYPE_USERNAME and SONATYPE_PASSWORD are user tokens (not your account password). Regenerate at central.sonatype.com.