-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
116 lines (106 loc) · 3.08 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
image: registry.gitlab.com/josm/docker-library/openjdk:8
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- mkdir -p "$GRADLE_USER_HOME" && echo "org.gradle.caching=true" >> "$GRADLE_USER_HOME/gradle.properties"
cache:
paths:
- .gradle/caches/build-cache-*
include:
- template: Security/Dependency-Scanning.gitlab-ci.yml
assemble:
stage: build
script:
- ./gradlew --stacktrace assemble
artifacts:
paths:
- build/
test:
stage: test
script:
- apt-get update && apt-get install -y firefox-esr # Needed for i18n:jsBrowserTest
- ./gradlew --stacktrace :build
artifacts:
paths:
- build/
reports:
junit:
- i18n/build/test-results/jvmTest/TEST-*.xml
- plugin/build/test-results/test/**/TEST-*.xml
needs:
- assemble
publish to / OSS Sonatype Staging:
stage: deploy
environment:
name: maven / OSS Sonatype Staging
url: https://oss.sonatype.org/content/groups/staging/org/openstreetmap/josm
script:
- ./gradlew publishAllPublicationsToOssSonatypeStagingRepository
needs:
- test
only:
refs:
- tags@JOSM/gradle-josm-plugin
variables:
- $SONATYPE_USERNAME
- $SONATYPE_PASSWORD
publish to / Gradle Plugin Portal:
stage: deploy
environment:
name: maven / Gradle Plugin Portal
url: https://plugins.gradle.org/plugin/org.openstreetmap.josm
script:
- ./gradlew -Pgradle.publish.secret="$GRADLE_PUBLISH_SECRET" -Pgradle.publish.key="$GRADLE_PUBLISH_KEY" publishPlugins
needs:
- test
only:
refs:
- tags@JOSM/gradle-josm-plugin
variables:
- $GRADLE_PUBLISH_KEY
- $GRADLE_PUBLISH_SECRET
publish to / GitLab.com Maven:
stage: deploy
environment:
name: maven / gitlab.com
url: https://gitlab.com/JOSM/gradle-josm-plugin/-/packages
script:
- ./gradlew publishAllPublicationsToGitlabRepository
- ./gradlew releaseToGitlab
needs:
- test
only:
- tags@JOSM/gradle-josm-plugin
publish to / pages branch:
stage: deploy
environment:
name: maven / pages branch plus KDoc
url: https://gitlab.com/JOSM/gradle-josm-plugin/tree/pages
script:
- |
mkdir -p ~/.ssh/
echo "$SSH_GITLAB_PUBLIC_KEY" >> ~/.ssh/known_hosts
echo "$SSH_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod -R 600 ~/.ssh
git clone --depth 1 --branch pages [email protected]:JOSM/gradle-josm-plugin.git public
- |
version=`git describe --always --dirty`
longVersion=`git describe --always --long --dirty`
rm -rf build/maven/
mv public/maven/ build/maven/
./gradlew publishAllPublicationsToBuildDirRepository dokkaHtmlMultimodule
mv build/maven/ public/maven/
mv build/docs/kdoc/ "public/kdoc/$version/"
- |
cd public/
git rm --ignore-unmatch kdoc/current kdoc/latest
ln -s "./$version" kdoc/latest
git stage .
- |
git config user.name "Deploy with GitLab CI"
git config user.email "contact-project+josm-gradle-josm-plugin-5042462-issue-@incoming.gitlab.com"
git commit -a -m "Update Maven repository and KDoc documentation to $longVersion"
git push origin pages
needs:
- test
only:
- tags@JOSM/gradle-josm-plugin