Skip to content

Commit 147a792

Browse files
ci: add step to trigger deployment
1 parent 466cfbe commit 147a792

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

.gitlab-ci.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,52 @@ test_examples_manual:
204204

205205
# stage: publish -------------------------
206206

207-
publish:
207+
.publish_base:
208208
stage: publish
209209
extends: .publish
210210
dependencies:
211211
- build_scheduled
212212
- build_manual
213-
rules:
214-
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
215213
script:
216214
- ./gradlew publish
217215

216+
publish:
217+
extends: .publish_base
218+
rules:
219+
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
220+
218221
publish_manual:
219-
stage: publish
220-
extends: .publish
222+
extends: .publish_base
221223
when: manual
224+
225+
## trigger deployment
226+
227+
.trigger_deployment_base:
228+
extends: .publish
229+
stage: publish
230+
image: curlimages/curl:8.14.1
231+
script:
232+
- NAMESPACE="com.deepl.api"
233+
- URL="https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$NAMESPACE"
234+
- PARAMS="publishing_type=automatic"
235+
- BEARER_TOKEN=$(echo "${ORG_GRADLE_PROJECT_mavenUploadUsername}:${ORG_GRADLE_PROJECT_mavenUploadPassword}" | base64)
236+
- |
237+
curl "$URL?$PARAMS" --header "Authorization: Bearer $BEARER_TOKEN" -d "" --write-out "%{http_code}\n"
238+
239+
trigger_deployment:
240+
extends: .trigger_deployment_base
222241
dependencies:
223-
- build_scheduled
224-
- build_manual
242+
- publish
225243
rules:
226244
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
227-
script:
228-
- ./gradlew publish
245+
246+
trigger_deployment_manual:
247+
extends: .trigger_deployment_base
248+
dependencies:
249+
- publish_manual
250+
when: manual
251+
252+
## gitlab release
229253

230254
gitlab release:
231255
stage: publish

0 commit comments

Comments
 (0)