.gitlab-ci.yml 1.38 KB
Newer Older
Matthias Betz's avatar
Matthias Betz committed
1
image: debian:latest
2
3


Matthias Betz's avatar
Matthias Betz committed
4
5
build:
    script:
Matthias Betz's avatar
Matthias Betz committed
6
        - apt-get update
Matthias Betz's avatar
Matthias Betz committed
7
        - apt-get install -y wget
Matthias Betz's avatar
Matthias Betz committed
8
        - wget https://download.bell-sw.com/java/8u252+9/bellsoft-jdk8u252+9-linux-amd64-full.deb
Matthias Betz's avatar
Matthias Betz committed
9
        - dpkg -i bellsoft-jdk8u252+9-linux-amd64-full.deb
Matthias Betz's avatar
Matthias Betz committed
10

Matthias Betz's avatar
Matthias Betz committed
11
        - apt-get install -y maven
Matthias Betz's avatar
Matthias Betz committed
12
        - mvn package -B
Matthias Betz's avatar
Matthias Betz committed
13
14
15
        
release:
    script:
Matthias Betz's avatar
Matthias Betz committed
16
        - mvn package -B
Matthias Betz's avatar
Matthias Betz committed
17
        - FILE=$(ls target/ | grep '\.zip$' | head -n 1)
Matthias Betz's avatar
Matthias Betz committed
18
19
20
        - echo ${FILE}
        - echo ${CI_PROJECT_ID}
        - echo ${CI_COMMIT_TAG}
Matthias Betz's avatar
Matthias Betz committed
21
        - echo ${CI_API_V4_URL}
Matthias Betz's avatar
Matthias Betz committed
22
        - echo ${CI_PROJECT_URL}
Matthias Betz's avatar
Matthias Betz committed
23
24
25
26
        - 'UPLOAD_RESULT=$(curl --request POST --header "Private-Token: ${TOKEN}" --form "file=@target/${FILE}" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/uploads)'
        - echo ${UPLOAD_RESULT}
        - FILE_URL=$(echo ${UPLOAD_RESULT} | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["url"]')
        - echo ${FILE_URL}
Matthias Betz's avatar
Matthias Betz committed
27
        - 'DATA="{\"name\": \"Release ${CI_COMMIT_TAG}\", \"tag_name\": \"${CI_COMMIT_TAG}\", \"description\": \"RegionChooser Release\", \"assets\": { \"links\": [{ \"name\": \"${FILE}\", \"url\": \"${CI_PROJECT_URL}${FILE_URL}\"}] } }"'
Matthias Betz's avatar
Matthias Betz committed
28
        - echo ${DATA}
Matthias Betz's avatar
Matthias Betz committed
29
        - 'curl --header "Content-Type: application/json" --header "Private-Token: ${TOKEN}" --data "${DATA}" --request POST ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases'
Matthias Betz's avatar
Matthias Betz committed
30
31
    only:
        refs:
Matthias Betz's avatar
Matthias Betz committed
32
            - tags
Matthias Betz's avatar
Matthias Betz committed
33