-
Notifications
You must be signed in to change notification settings - Fork 89
fix: allow custom package name when uploading generic_package assets #607
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
base: master
Are you sure you want to change the base?
fix: allow custom package name when uploading generic_package assets #607
Conversation
It actually does not correct if the configuration provide a regex path (may match multiple files to upload). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the option to configure the package name is a good idea.
But I would only provide this configuration option and would not change other functionalities.
Unit tests should be added, too.
lib/publish.js
Outdated
@@ -88,11 +88,14 @@ export default async (pluginConfig, context) => { | |||
|
|||
if (target === "generic_package") { | |||
// Upload generic packages | |||
const encodedLabel = encodeURIComponent(label); | |||
const { major, minor, patch } = semver.parse(version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand that correct, this renders it impossible to use prereleases (alpha, beta).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this does not look correct. GitLab allows much more:
The package version. The following regex validates this: \A(.?[\w+-]+.?)+\z. You can test your version strings on Rubular.
I would update the implementation and add unit tests later when the implementation has been approved. |
@phuocnb Feel free to go on and ping me if you're stuck somewhere! |
I were so busy in the last 2 months. |
@fgreinacher @JonasSchubert
The upload request actually return a This is the full job log After running the above job, the result is:
Changing the
In the line 98-103
line 115-118
I believe that This is the original issue that i want to commit a fix on this PR. Anyway, i still working on this issue (on another branch). |
Any updates on this ? I really need this feature for my workflow too |
…neric-package-name
same filenames may exist in different directories
Thanks for getting back to this @phuocnb! The implementation looks fine at a first sight. Would you please update the PR description to match the implementation? Just to not confuse users that end up here from the changelog 😀 Thansk! |
The current
generic_package
upload does not allow to set a custom package name. It's alwaysrelease
.According to gitlab url format:
/projects/:id/packages/generic/:package_name/:package_version/:file_name?status=:status
What i did:
I add
packageName
as a new option ofasset
that allows to set a custom package name instead ofrelease
. It will userelease
as package name if the option is not defined.