Skip to main content
Version: 0.15 (glpkg CLI)

glpkg publish

Publish the package in the current directory to the package registry of the current GitLab project.

glpkg publish|pub [options] [type]

Arguments and options​

OptionDescription
[type]latest (default), dev or beta. For npm this is also the dist-tag.
--bump <type>Bump the version first: patch, minor or major
--dry-runDo everything except upload and Git steps. package.json, pyproject.toml and *.csproj are restored afterwards.
--token <token>Use this token instead of the saved one
--no-buildSkip the build step (PyPI: python -m build; NuGet: dotnet pack)
--git-tag <bool>Create the release commit and tag (default true)
--push <bool>Push to the remote after publishing (default true)
--forcePublish even if the Git working tree is not clean
--no-repositoryDo not add a repository field to package.json from the Git origin
--pypi / --go / --nuget / --genericPublish another package type
--manifest <file>Manifest file for --generic (default glpkg.json)

--git-tag and --push take the strings true or false. Their defaults can be changed with glpkg config defaults.

Requirements​

  • A token (saved, GITLAB_TOKEN, or --token).
  • git and glab. glpkg runs glab api projects/:id to find the GitLab project of the current repository and publishes to that project's registry. It does not create projects.
  • A clean working tree, unless --force or --dry-run.

Versions​

Commandpackage.json 1.2.3 becomesnpm dist-tag
glpkg publish1.2.3 (unchanged)latest
glpkg publish --bump patch1.2.4latest
glpkg publish --bump minor1.3.0latest
glpkg publish beta --bump minor1.3.0-beta.0beta
glpkg publish beta1.2.3 (unchanged)beta
glpkg publish dev1.2.3-dev.<timestamp>dev

--bump drops any pre-release suffix before incrementing (1.3.0-beta.0 + patch → 1.3.1). A dev publish always uses the current base version plus a timestamp.

Git steps​

After a successful upload, for latest and beta:

  1. git add <manifest> && git commit -m "chore: release v<version>"
  2. git tag v<version>
  3. git push, then git push --tags

A dev publish creates no commit or tag; it writes the dev version into package.json and leaves it uncommitted. With --push on, it still runs git push.

Turn the steps off with --git-tag false and/or --push false. A failed push prints a warning; push manually afterwards.

repository field​

If package.json has no repository field, glpkg adds one from the Git origin URL before publishing, so the published package links to its source. It is committed with the release commit. Use --no-repository to skip this.

Other package types​

TypeReadsWhat happens
--pypipyproject.tomlpython -m build, then twine upload to the project PyPI registry. Needs build and twine.
--nuget*.csprojdotnet pack -c Release, then dotnet nuget push to the project NuGet registry (duplicates skipped).
--gogo.modNo upload: runs go mod tidy, creates the next version tag (latest tag + --bump, or + patch) and pushes it. GitLab serves the module from the tag. [type] and --git-tag are not used; --push false skips the push.
--genericglpkg.json or --manifestCreates a tarball and uploads it to the project generic registry. [type] and --bump are not used.

See Python, Go, NuGet and generic packages.

Examples​

glpkg publish --dry-run
glpkg publish --bump patch
glpkg publish beta --bump minor
glpkg publish --bump patch --git-tag false --push false # CI without git writes
glpkg publish --pypi --bump patch
glpkg publish --go --bump minor