On tag, upload artifacts to project and update tag note

This commit is contained in:
Luc Didry 2019-01-07 10:00:13 +01:00
parent 5b29497859
commit ec53d9c504
No known key found for this signature in database
GPG Key ID: EA868E12D0257E3C
1 changed files with 10 additions and 0 deletions

View File

@ -47,6 +47,16 @@ pages:
- mkdir .public
- cp latest.zip .public
- mv .public public
- if [[ -z $GITLAB_API_TOKEN ]]; then exit; fi
- export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
- export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}"
- export RELEASE_URL="${DESCRIPTION_URL}/release"
- 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
- export artifactUrl=$(curl --request POST --header "${HEADER}" --form "file=@public/latest.zip" "${PROJECT_API_URL}/uploads" | jq .url)
- export description=$(curl -s --header "${HEADER}" "${DESCRIPTION_URL}" | jq .release.description | sed -e 's@"@@g')
- if [[ $description == 'null' ]]; then export METHOD="POST"; echo -e 'You can download the release zip here:'" [latest.zip](${artifactUrl})" > /tmp/text; fi
- if [[ $description != 'null' ]]; then export METHOD="PUT"; echo -e "${description}\n\n"'You can download the release zip here:'" [latest.zip](${artifactUrl})" > /tmp/text; fi
- curl -s --request $METHOD --data-urlencode "description@/tmp/text" --header "${HEADER}" "${RELEASE_URL}"
artifacts:
paths:
- public