Skip to content

fix: added support for generic package name #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Rechem
Copy link

@Rechem Rechem commented Jul 29, 2025

The current version of this project doesn't support custom generic packages names, instead publishes them under the release package.

When publishing generic packages to the package repository on Gitlab, you are able to specify the name of your package in the URL : /projects/:id/packages/generic/:package_name/:package_version/:file_name

I added the ability to provide a custom package name through the optional packageName property.

Usage example:

{
  "branches": ["main"],
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "@semantic-release/gitlab",
      {
        "gitlabUrl": "https://custom.gitlab.com",
        "assets": [
          { "path": "dist/asset.min.js", "label": "JS distribution", "target": "generic_package", "packageName": "styles" },
        ]
      }
    ]
  ]
}

This will create a new styles package in the Gitlab package repository with the specified files.

@fgreinacher fgreinacher requested a review from Copilot August 1, 2025 18:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for custom generic package names in GitLab package publishing. Previously, all generic packages were published under the hardcoded "release" package name, but now users can specify a custom package name through an optional packageName property.

  • Added packageName parameter support with "release" as default fallback
  • Updated URL construction to use the custom package name in both upload and download endpoints
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/publish.js Implements packageName parameter processing and updates generic package URL construction
test/publish.test.js Adds test case verifying custom package name functionality with proper URL encoding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants