-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
50 lines (44 loc) · 1.2 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
image: openjdk:8-jdk
stages:
- build
- upload
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- apt update && apt install gettext-base
###################
# Build
###################
build-jar:
stage: build
variables:
VERSION: build
OSSRHUSERNAME: ossrhusername
OSSRHPASSWORD: ossrhpassword
script:
- envsubst '${VERSION}','${OSSRHUSERNAME}','${OSSRHPASSWORD}' < build.gradle > build.gradle.new
- mv build.gradle.new build.gradle
- ./gradlew assemble
except:
- tags
###################
# Upload
###################
upload-jar:
stage: upload
variables:
OSSRHUSERNAME: ${OSSRH_LOGIN}
OSSRHPASSWORD: ${OSSRH_PASS}
script:
- VERSION=$(echo ${CI_COMMIT_REF_NAME} | sed "s/v//")
- export VERSION=$VERSION
- envsubst '${VERSION}','${OSSRHUSERNAME}','${OSSRHPASSWORD}' < build.gradle > build.gradle.new
- mv build.gradle.new build.gradle
- mkdir .gradle
- echo "$GPG_KEY_PRIVATE" > private.key
- gpg --import private.key
- gpg --export-secret-keys -o secring.gpg
- echo "$GRADLE_PROPERTIES" > $GRADLE_USER_HOME/gradle.properties
- ./gradlew -Psign uploadArchives
- ./gradlew closeAndReleaseRepository
only:
- tags