How to POST a release that includes a source file tarball asset?
Hi I have the following release job in .gitlab-ci.yml that serves to create a release using the gitlab api:
release:
image: node:12-stretch-slim
stage: release
before_script:
- apt-get update && apt-get install -y curl git jq
script:
- version=$(git describe --tags | cut -d'-' -f 1 | sed 's/^v*//')
- echo "generating release for version ${version}"
- npm pack
- url="my url goes here"
- >
curl --request POST
--header 'Content-Type: application/json'
--header "Private-Token: ${API_TOKEN}"
--data '$@-' "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/releases" << EOF
{
"name": "Release v${version}",
"tag_name": "v${version}",
"ref": "v${version}",
"description": "Description",
"assets": {
"links": [
{
"name": "objectdetection-plugin-source",
"url": "${CI_PROJECT_URL}/${url}",
"filepath": "${url}",
"link_type": "other"
}
]
}
}
EOF
when: manual
only:
- /^release-.*$/
When I run the job on gitlab.com I get the following error in the job output:
$ curl --request POST --header 'Content-Type: application/json' --header "Private-Token: ${API_TOKEN}" --data '$@-' "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/releases" << EOF { # collapsed multi-line command
/bin/bash: line 134: warning: here-document at line 119 delimited by end-of-file (wanted `EOF')
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3 0 0 100 3 0 13 --:--:-- --:--:-- --:--:-- 13
curl: (3) [globbing] unmatched brace in column 1
ERROR: Job failed: exit code 1
Has anyone managed to create a release with assets?