Official website reference link
Note: I did not find the entry on the Chinese official website, but this is on the English version website.
1. Official standard format
PUT:
/projects/:id/packages/generic/:package_name/:package_version/:file_name?status=:status
2. Necessary field naming convention
1. package_name (package name):
This field can contain 大小写字母
, 数字
, 连字符 -
, 下划线 _
,点 .
2. package_version (package version number):
This field must match this regular expression , which can be verified on the Rubular\A(\.?[\w\+-]+\.?)+\z
website provided by the official website . Personal understanding: It is basically fine if it does not contain spaces.
3. file_name (file name):
This field is the same as the registration and can contain uppercase and lowercase letters, numbers, dots, hyphens, and underscores
3. Practical examples
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--upload-file path/to/file.txt \
"https://gitlab.example.com/api/v4/projects/24/packages/generic/my_package/0.0.1/file.txt"
In the powershell terminal of windows, it can be used like this:
Invoke-RestMethod -Headers @{
"JOB-TOKEN"="$CI_JOB_TOKEN" } -InFile "$FILE_NAME.exe" -uri "$PACKAGE_REGISTRY_URL/$PACKAGE_NAME/$PACKAGE_VERSION/$FILE_NAME.exe" -Method put