Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab how to comment the release in the CI?

Tags:

gitlab-ci

I have a maven project that I build using gitlab. When a tag is created, I run 'mvn package'. This create a jar, that is then copy and launch on the server. -> All this works well.

Now I would like to add automatically in the release note, all the commits that occurs between this tag and the previous tag, so that I know what is deployed in this tag.

How I can do that during the CI ?

like image 235
Tyvain Avatar asked Jan 14 '19 04:01

Tyvain


1 Answers

I made it work like this:

# create release note
    - >- 
        curl --request POST 
        -H "PRIVATE-TOKEN: ${GITLABAPI_TOKEN}" 
        -H 'Content-Type: application/json' 
        --data "{\"description\": \"`git log $(git tag --sort version:refname | tail -n 2 | head -n 1)..$(git tag --sort version:refname | tail -n 1) --oneline | sed '$!s/$/<br>/' | tr -d '\n'`\"}"
        https://gitlab.unc.nc/api/v4/projects/${APP_GITLAB_NUMBER}/repository/tags/${CI_COMMIT_TAG}/release

This update the release note of the tag, with all commits that occurs between the 2 last commits.

like image 103
Tyvain Avatar answered Oct 25 '22 23:10

Tyvain